timbrel / GitSavvy

Full git and GitHub integration with Sublime Text
MIT License
1.9k stars 135 forks source link

Fix `get_branches` when HEAD cannot get resolved #1851

Closed kaste closed 6 months ago

kaste commented 6 months ago

We unconditionally ask for ahead-behind:HEAD in get_branches() which is okay unless HEAD cannot get resolved. E.g. on a new repo without any commits, the initial branch "main" might get created and HEAD might then refer to "refs/heads/main" but this file does not exist as there are no commits yet.

Just run without AheadBehind in that case.

As this is a rare case call for-each-ref as before but check for the error to call it again without ahead-before:HEAD. This is efficient for the 99.99% use-case.