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 860B

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