Skip to content

Commit

Permalink
fix(Git): Only bulldoze the repository if HEAD or branch cannot be found
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed May 9, 2024
1 parent d439d11 commit 8d93817
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/adapters/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class GitAdapter extends CachingAdapter {
Logger.log('(git) checkout branch ' + (this.server.branch))
await git.checkout({ fs: this.fs, dir: this.dir, ref: this.server.branch })
} catch (e) {
if (e && e.code === git.Errors.NotFoundError.code) {
if (e && e.code === git.Errors.NotFoundError.code && (e.data.what === 'HEAD' || e.data.what === this.server.branch)) {
Logger.log('(git) writeFile ' + this.dir + '/README.md')
await this.fs.promises.writeFile(this.dir + '/README.md', 'This repository is used to syncrhonize bookmarks via [floccus](https://floccus.org).', {mode: 0o777, encoding: 'utf8'})
Logger.log('(git) add .')
Expand Down

0 comments on commit 8d93817

Please sign in to comment.