From 3ad0928885271245c22b9ad7f8e83e2e013e7201 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 20 Jan 2024 11:43:13 +0100 Subject: [PATCH] fix(git): Don't use remote repos, use URL directly Signed-off-by: Marcel Klehr --- src/lib/adapters/Git.ts | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/lib/adapters/Git.ts b/src/lib/adapters/Git.ts index f27868042b..1292c53064 100644 --- a/src/lib/adapters/Git.ts +++ b/src/lib/adapters/Git.ts @@ -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({ @@ -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() }) @@ -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() }) @@ -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() }) @@ -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) } @@ -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 @@ -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({ @@ -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() }) @@ -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() })