Skip to content

Commit

Permalink
fix(git): Don't use remote repos, use URL directly
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jan 20, 2024
1 parent 4ad329d commit 3ad0928
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions src/lib/adapters/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ 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 @@ -111,7 +103,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
tags: true,
pruneTags: true,
remote: 'origin',
url: this.server.url,
depth: 10,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -143,7 +135,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
ref: this.server.branch,
remoteRef: this.server.branch,
remote: 'origin',
url: this.server.url,
force: true,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -204,7 +196,7 @@ export default class GitAdapter extends CachingAdapter {
fs,
http,
dir: this.dir,
remote: 'origin',
url: this.server.url,
force: true,
onAuth: () => this.onAuth()
})
Expand Down Expand Up @@ -239,7 +231,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, onAuth: () => this.onAuth() })
await git.push({ fs, http, dir: this.dir, ref: tag, url: this.server.url, onAuth: () => this.onAuth() })
this.locked.push(tag)
}

Expand All @@ -255,7 +247,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, onAuth: () => this.onAuth() })
await git.push({ fs, http, dir: this.dir, ref: tag, delete: true, url: this.server.url, onAuth: () => this.onAuth() })
}
this.locked = []
return true
Expand Down Expand Up @@ -319,13 +311,6 @@ 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 @@ -346,7 +331,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
ref: this.server.branch,
remoteRef: this.server.branch,
remote: 'origin',
url: this.server.url,
force: true,
onAuth: () => this.onAuth()
})
Expand All @@ -356,7 +341,7 @@ export default class GitAdapter extends CachingAdapter {
dir: this.dir,
tags: true,
pruneTags: true,
remote: 'origin',
url: this.server.url,
depth: 10,
onAuth: () => this.onAuth()
})
Expand Down

0 comments on commit 3ad0928

Please sign in to comment.