[Vm-dev] git-hook considered harmfull!

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Dec 29 15:28:43 UTC 2018


Hi all,
I'm working a lot with git stash.
This is because while fixing a problem, my analysis lead me thru another
piece of code and other problems that I fix too, and at the end, I have a
bunch of changes.
I don't want to commit each single fix, because they are often partial, not
well ordered and it would mean rewriting history thru git rebase -i which
is OK for not too complex mess, but not that great for interactivity.
It's much much more simple and interactive to have a pool of changes in the
working copy, selectively pick some feature to stage via a good GUI client
(sourceTree works well for me), stash the rest to check if compilation OK,
etc...

I even often maintain a stack of stashes for different features.
For example, I have stashed changes for FloatMathPlugin fixes that I want
to be integrated when I compile my own VM, but that I don't want to commit
into another feature branch. since git 2.13 it's as simple as

    git stash push -m "FloatMathPluginFix"
platforms/Cross/plugins/FloatMathPlugin/

That's very lightweight compared to having specific branches for doing the
merge...

Oui mais voilĂ , each time I commit, merge or checkout a new branch, my
latest stash is popped which mean applied when I don't want to, and removed
from my stack of stashes which I ABSOLUTELY do not want to!
More other, when attempting a rebase -i, I often encounter undesired side
effects...
This is really annoying/completely disrupting my own workflow.
After searching the root cause on forums, I finally discovered the source
of my problems: .git/hooks/post-checkout same for post-commit post-merge

It performs a git stash (save), checkout/commit/merge, then git stash pop.
Err, except that if there is nothing to save, git stash does nothing, but
still, git stash pop will pop one of my carefully crafted feature stash.
This is exactly as described in an answer to
https://stackoverflow.com/questions/27697835/stash-branch-working-copy-confusion

As suggested in this answer, git stash pop should be perform if AND ONLY IF
git stash save changed the SHA1!
I don't really know how to do that, but would greatly appreciate if the
author of these hooks would help me fixing this mess :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20181229/54e87fb2/attachment.html>


More information about the Vm-dev mailing list