You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

git.elv 775B

1234567891011121314151617181920212223242526272829303132333435363738
  1. use str
  2. branch = ''
  3. dirty = 0
  4. staged = 0
  5. untracked = 0
  6. ahead = 0
  7. behind = 0
  8. fn refresh-status {
  9. branch = ''
  10. dirty = 0
  11. staged = 0
  12. untracked = 0
  13. ahead = 0
  14. behind = 0
  15. _ = ?(
  16. @data = (git --no-optional-locks status --ignore-submodules --porcelain=v2 -b 2>&-)
  17. branch = [(str:split ' ' $data[1])][2]
  18. if (and (> (count $data) 3) (has-prefix $data[3] '# branch.ab')) {
  19. ahead behind = (all [(str:split ' ' $data[3])][2:])[1:]
  20. }
  21. for i $data {
  22. if (or (has-prefix $i 1) (has-prefix $i 2)) {
  23. if (eq $i[2] '.') {
  24. dirty = (+ $dirty 1)
  25. } else {
  26. staged = (+ $staged 1)
  27. }
  28. } elif (has-prefix $i '?') {
  29. untracked = (+ $untracked 1)
  30. }
  31. }
  32. )
  33. }