Bug fix for mepo status
This release fixes a bug in mepo status
.
The way mepo was figuring out what branch you were on with detached head was:
git show -s --pretty=%D HEAD
and then taking the second field. In most cases, this is fine, but sometimes you have two branches that are identical:
❯ git show -s --pretty=%D HEAD
HEAD, origin/feature/wputman/dyamond_v2, origin/develop, origin/HEAD, develop
So, even though you checked out develop
, mepo status
was returning that after running mepo clone
you were on feature/wputman/dyamond_v2
. While this isn't incorrect, it doesn't match where we started and mepo shows a difference.
After looking at the git source code, I think it uses the internals used for the reflog to get this. If I look at the git-reflog
output:
❯ git reflog
eb7e199 (HEAD, origin/feature/wputman/dyamond_v2, origin/develop, origin/HEAD, develop) HEAD@{0}: checkout: moving from develop to origin/develop
eb7e199 (HEAD, origin/feature/wputman/dyamond_v2, origin/develop, origin/HEAD, develop) HEAD@{1}: clone: from github.com:GEOS-ESM/GEOSgcm_GridComp.git
Now we see internally it knows we checked out develop
and then detached to origin/develop
. We can capture this knowledge with git reflog HEAD -n 1
and then take the last part of the string.
I also clean up an odd save issue.