Skip to content

Commit

Permalink
Revert "fix(git): Don't use remote repos, use URL directly"
Browse files Browse the repository at this point in the history
This reverts commit 3ad0928.
  • Loading branch information
marcelklehr committed Jan 20, 2024
1 parent 3ad0928 commit 926c872
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/lib/adapters/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ export default class GitAdapter extends CachingAdapter {

Logger.log('(git) init')
await git.init({ fs, dir: this.dir })
await git.addRemote({
fs,
dir: this.dir,
url: this.server.url,
remote: 'origin',
force: true
})

try {
Logger.log('(git) fetch from remote')
await git.fetch({
Expand All @@ -103,7 +111,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
tags: true,
pruneTags: true,
url: this.server.url,
remote: 'origin',
depth: 10,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -135,7 +143,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
ref: this.server.branch,
remoteRef: this.server.branch,
url: this.server.url,
remote: 'origin',
force: true,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -196,7 +204,7 @@ export default class GitAdapter extends CachingAdapter {
fs,
http,
dir: this.dir,
url: this.server.url,
remote: 'origin',
force: true,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -231,7 +239,7 @@ export default class GitAdapter extends CachingAdapter {
Logger.log('(git) tag ' + tag)
await git.tag({ fs, dir: this.dir, ref: tag })
Logger.log('(git) push tag ' + tag)
await git.push({ fs, http, dir: this.dir, ref: tag, url: this.server.url, onAuth: () => this.onAuth() })
await git.push({ fs, http, dir: this.dir, ref: tag, onAuth: () => this.onAuth() })
this.locked.push(tag)
}

Expand All @@ -247,7 +255,7 @@ export default class GitAdapter extends CachingAdapter {
try {
for (const tag of this.locked) {
Logger.log('(git) push: delete tag ' + tag)
await git.push({ fs, http, dir: this.dir, ref: tag, delete: true, url: this.server.url, onAuth: () => this.onAuth() })
await git.push({ fs, http, dir: this.dir, ref: tag, delete: true, onAuth: () => this.onAuth() })
}
this.locked = []
return true
Expand Down Expand Up @@ -311,6 +319,13 @@ export default class GitAdapter extends CachingAdapter {

Logger.log('(git) init')
await git.init({ fs, dir: this.dir, defaultBranch: this.server.branch })
await git.addRemote({
fs,
dir: this.dir,
url: this.server.url,
remote: 'origin',
force: true
})
await fs.promises.writeFile(this.dir + '/README.md', 'This repository is used to syncrhonize bookmarks via [floccus](https://floccus.org).', {mode: 0o777, encoding: 'utf8'})
await git.add({fs, dir: this.dir, filepath: '.'})
await git.commit({
Expand All @@ -331,7 +346,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
ref: this.server.branch,
remoteRef: this.server.branch,
url: this.server.url,
remote: 'origin',
force: true,
onAuth: () => this.onAuth()
})
Expand All @@ -341,7 +356,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
tags: true,
pruneTags: true,
url: this.server.url,
remote: 'origin',
depth: 10,
onAuth: () => this.onAuth()
})
Expand Down

0 comments on commit 926c872

Please sign in to comment.