浏览代码

Fix git elvish module

master
SolitudeSF 3 年前
父节点
当前提交
efbe32b323
找不到此签名对应的密钥
GPG 密钥 ID: 789B06817C385387
  1. 46
      elvish/lib/git.elv

46
elvish/lib/git.elv

@ -6,31 +6,31 @@ ahead = 0 @@ -6,31 +6,31 @@ ahead = 0
behind = 0
fn refresh-status {
branch = ''
dirty = 0
staged = 0
untracked = 0
ahead = 0
behind = 0
branch = ''
dirty = 0
staged = 0
untracked = 0
ahead = 0
behind = 0
_ = ?(
data = [(git --no-optional-locks status --ignore-submodules --porcelain=v2 -b 2>/dev/null)]
branch = [(splits ' ' $data[1])][2]
_ = ?(
@data = (git --no-optional-locks status --ignore-submodules --porcelain=v2 -b 2>/dev/null)
branch = [(splits ' ' $data[1])][2]
if (has-prefix $data[3] '# branch.ab') {
ahead behind = (explode [(splits ' ' $data[3])][2:])[1:]
}
if (and (> (count $data) 3) (has-prefix $data[3] '# branch.ab')) {
ahead behind = (explode [(splits ' ' $data[3])][2:])[1:]
}
for i $data {
if (or (has-prefix $i 1) (has-prefix $i 2)) {
if (eq $i[2] .) {
dirty = (+ $dirty 1)
} else {
staged = (+ $staged 1)
}
} elif (has-prefix $i '?') {
untracked = (+ $untracked 1)
}
for i $data {
if (or (has-prefix $i 1) (has-prefix $i 2)) {
if (eq $i[2] '.') {
dirty = (+ $dirty 1)
} else {
staged = (+ $staged 1)
}
)
} elif (has-prefix $i '?') {
untracked = (+ $untracked 1)
}
}
)
}

正在加载...
取消
保存