Skip to content

Commit

Permalink
Handle clone with conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gatzjames committed Nov 7, 2024
1 parent c385971 commit af61ba3
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/insomnia/src/sync/git/git-vcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,24 @@ export class GitVCS {
http: httpClient,
repoId,
};
await git.clone({
...this._baseOpts,
url,
singleBranch: true,
});
console.log(`[git] Clones repo to ${gitDirectory} from ${url}`);
try {
await git.clone({
...this._baseOpts,
url,
singleBranch: true,
});
} catch (err) {
// If we there is a checkout conflict we only want to clone the repo
if (err instanceof git.Errors.CheckoutConflictError) {
await git.clone({
...this._baseOpts,
url,
singleBranch: true,
noCheckout: true,
});
}
}
console.log(`[git] Cloned repo to ${gitDirectory} from ${url}`);
}

isInitializedForRepo(id: string) {
Expand Down

0 comments on commit af61ba3

Please sign in to comment.