mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Git - Handle tag conflict during pull operation (#167278)
Handle tag conflict during pull operation
This commit is contained in:
@@ -1764,6 +1764,25 @@ export class Repository {
|
||||
}
|
||||
}
|
||||
|
||||
async fetchTags(options: { remote: string; tags: string[]; force?: boolean }): Promise<void> {
|
||||
const args = ['fetch'];
|
||||
const spawnOptions: SpawnOptions = {
|
||||
env: { 'GIT_HTTP_USER_AGENT': this.git.userAgent }
|
||||
};
|
||||
|
||||
args.push(options.remote);
|
||||
|
||||
for (const tag of options.tags) {
|
||||
args.push(`refs/tags/${tag}:refs/tags/${tag}`);
|
||||
}
|
||||
|
||||
if (options.force) {
|
||||
args.push('--force');
|
||||
}
|
||||
|
||||
await this.exec(args, spawnOptions);
|
||||
}
|
||||
|
||||
async pull(rebase?: boolean, remote?: string, branch?: string, options: PullOptions = {}): Promise<void> {
|
||||
const args = ['pull'];
|
||||
|
||||
@@ -1803,6 +1822,8 @@ export class Repository {
|
||||
err.gitErrorCode = GitErrorCodes.CantLockRef;
|
||||
} else if (/cannot rebase onto multiple branches/i.test(err.stderr || '')) {
|
||||
err.gitErrorCode = GitErrorCodes.CantRebaseMultipleBranches;
|
||||
} else if (/! \[rejected\].*\(would clobber existing tag\)/m.test(err.stderr || '')) {
|
||||
err.gitErrorCode = GitErrorCodes.TagConflict;
|
||||
}
|
||||
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user