diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index ed4b6b5c0c0ee5bacbec9fd11c741b45ff59fee8..a3f54427a77e44be2b1b39f0c5cc943e984c881b 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1978,7 +1978,14 @@ export class Repository { return this.getHEAD(); } - const result = await this.run(['for-each-ref', '--format=%(refname)%00%(upstream:short)%00%(upstream:track)%00%(objectname)', `refs/heads/${name}`, `refs/remotes/${name}`]); + const args = ['for-each-ref', '--format=%(refname)%00%(upstream:short)%00%(upstream:track)%00%(objectname)']; + if (/^refs\/(head|remotes)\//i.test(name)) { + args.push(name); + } else { + args.push(`refs/heads/${name}`, `refs/remotes/${name}`); + } + + const result = await this.run(args); const branches: Branch[] = result.stdout.trim().split('\n').map(line => { let [branchName, upstream, status, ref] = line.trim().split('\0');