Skip to content

Commit 7d24a40

Browse files
committed
Fixes #737 - avoids using lstrip
lstrip is only supported in more recent git versions
1 parent f1f6c1d commit 7d24a40

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/git/parsers/branchParser.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const rb = '%3e'; // `%${'>'.charCodeAt(0).toString(16)}`;
1111
export class GitBranchParser {
1212
static defaultFormat = [
1313
`${lb}h${rb}%(HEAD)`, // HEAD indicator
14-
`${lb}n${rb}%(refname:lstrip=1)`, // branch name
14+
`${lb}n${rb}%(refname)`, // branch name
1515
`${lb}u${rb}%(upstream:short)`, // branch upstream
1616
`${lb}t${rb}%(upstream:track)`, // branch upstream tracking state
1717
`${lb}r${rb}%(objectname)` // ref
@@ -54,14 +54,14 @@ export class GitBranchParser {
5454
behind = 0;
5555
}
5656

57-
if (name.startsWith('remotes/')) {
58-
// Strip off remotes/
59-
name = name.substr(8);
57+
if (name.startsWith('refs/remotes/')) {
58+
// Strip off refs/remotes/
59+
name = name.substr(13);
6060
remote = true;
6161
}
6262
else {
63-
// Strip off heads/
64-
name = name.substr(6);
63+
// Strip off refs/heads/
64+
name = name.substr(11);
6565
remote = false;
6666
}
6767

0 commit comments

Comments
 (0)