Browse Source

Fixes #737 - avoids using lstrip

lstrip is only supported in more recent git versions
main
Eric Amodio 5 years ago
parent
commit
7d24a402f7
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/git/parsers/branchParser.ts

+ 6
- 6
src/git/parsers/branchParser.ts View File

@ -11,7 +11,7 @@ const rb = '%3e'; // `%${'>'.charCodeAt(0).toString(16)}`;
export class GitBranchParser {
static defaultFormat = [
`${lb}h${rb}%(HEAD)`, // HEAD indicator
`${lb}n${rb}%(refname:lstrip=1)`, // branch name
`${lb}n${rb}%(refname)`, // branch name
`${lb}u${rb}%(upstream:short)`, // branch upstream
`${lb}t${rb}%(upstream:track)`, // branch upstream tracking state
`${lb}r${rb}%(objectname)` // ref
@ -54,14 +54,14 @@ export class GitBranchParser {
behind = 0;
}
if (name.startsWith('remotes/')) {
// Strip off remotes/
name = name.substr(8);
if (name.startsWith('refs/remotes/')) {
// Strip off refs/remotes/
name = name.substr(13);
remote = true;
}
else {
// Strip off heads/
name = name.substr(6);
// Strip off refs/heads/
name = name.substr(11);
remote = false;
}

Loading…
Cancel
Save