Browse Source

Fix git elvish module

master
SolitudeSF 1 year ago
parent
commit
efbe32b323
No known key found for this signature in database
1 changed files with 23 additions and 23 deletions
  1. 23
    23
      elvish/lib/git.elv

+ 23
- 23
elvish/lib/git.elv View File

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

Loading…
Cancel
Save