gitfs: fix new branch detection (pygit2)
gitfs: fix new branch detection (pygit2)

This fixes the same branch/tag detection issues resolved for GitPython
in the previous commit. Additionally, it refines the work done to fix
this issue in GitPython.

saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt