浏览代码

Fixes #737 - avoids using lstrip

lstrip is only supported in more recent git versions
main
Eric Amodio 5 年前
父节点
当前提交
7d24a402f7
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. +6
    -6
      src/git/parsers/branchParser.ts

+ 6
- 6
src/git/parsers/branchParser.ts 查看文件

@ -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;
}

正在加载...
取消
保存