Skip to content
Jeremy Pallats/starcraft.man edited this page Jun 5, 2018 · 6 revisions

Words from the Maintainer

This is a detailed explanation of this fork. I didn't want to terribly clutter the README with it. The original maintainer of this wonderful project has been inactive for almost 2.5 years. This is very unfortunate. I forked quite a while ago and have been maintaining my own modifications. I have recently begun using ZSH more and will thus maintain this fork actively from now on. I will try to check into github regularly, though I can't make a guarantee it will be daily.

I am a python programmer with a fair amount of shell experience. I am unfortunately not well versed in Haskell. I can thus ONLY personally guarantee the python version (and of course the zsh file).

I will have to rely on PRs from Haskell programmers to keep the Haskell version level with gitstatus.py . I will list the detailed gitstatus interface in issue #5 and likely keep that ticket open for questions/feedback/discussion. If you want to contribute by all means make a PR and discuss it with me.

Feature Status

Python: All features below are present when using gitstatus.py.

Haskell: Still compiles and works but currently lacks:

  • Stashed number support.
  • Local indicator support.
  • Upstream display support.
  • Customizing prefix hash.
  • Merging indicator support.
  • Rebase indicator support.

Notable Features Added

  • Complete rewrite of gitstatus.py for readability and improved performance. Notably eliminated all subprocess calls, now parse STDIN.

  • Complete unit testing of gitstatus.py. Standard python testing setup of: tox + pytest + flake8 + pylint.

  • Travis tests against supported python versions: 2.7, 3.4, 3.5, 3.6.

  • Compatability with git 2.17+ (common recurring problem noted on main repo)

  • Added indicator to show # of stashes on the repository. image

  • Added indicator to show if the branch has any tracking set (i.e. it is assumed local). It is possible you pushed it without -u and thus no tracking set. image

  • Added option to see the upstream remote currently tracked. You may choose to either always see remote/branch or just see remote when the branch matches the local one. image

  • Added ability to set python interpreter used to run gitstatus.py, ZSH_GIT_PROMPT_PYBIN=/path/to/interp

  • Ability to customize the prefix hash character (probably not often used). Only on python at this time.

  • Merging indicator appears any time you are merging. image

  • Rebase indicator appears during rebases, shows the current and total number of commits to work through. image

Due to the rewrite there may be regressions or changes in behaviour, if you encounter them please make an issue. If you want to help and have an idea, make a PR by all means.

Python Implementation Speed

I've done some testing on gitstatus.py comparing rewrite to old one. These are my thoughts:

  • The current version is faster, the old one made far too many subprocess.Popen calls.
  • Python is not really designed to be invoked so frequently on every prompt. The startup cost of invoking the interpreter is rather heavy. It now makes up a good portion of the time spent.
  • If you have the choice between python 2 and python 3, always use python 2. It seems to have lower overhead on startup. This is the default python still on most systems so no need for action.
  • It is likely that the pypy interpreter is faster than python2, just install and override python. I won't be providing any testing against that for now, should work.
  • The current version makes no subprocess calls if STDIN is connected and either parses for info or reads files. There may be optimizations to make in the future but I believe we are near the floor of how efficiently it can go.
  • While I like python, I personally would have probably not used it for this case. I would have probably written a small C/C++ program to handle the parsing and built with CMake. Alternatively, an even better solution would be completely processing in shell/zsh, that is a bit tedious though.