git-hook considered harmfull!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

git-hook considered harmfull!

Nicolas Cellier
 
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

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 :)
Reply | Threaded
Open this post in threaded view
|

Re: git-hook considered harmfull!

Jakob Reschke
 
I openend a pull request with modifications to the hook some months ago. Among other things, it does no longer use the stash there (mostly to make it faster). But it was not integrated yet.

Am Sa., 29. Dez. 2018, 16:29 hat Nicolas Cellier <[hidden email]> geschrieben:
 
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

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 :)
Reply | Threaded
Open this post in threaded view
|

Re: git-hook considered harmfull!

Nicolas Cellier
 
Ah thanks, that sounds great!
but there is a conflict... I need to check.

Le sam. 29 déc. 2018 à 16:37, Jakob Reschke <[hidden email]> a écrit :
 
I openend a pull request with modifications to the hook some months ago. Among other things, it does no longer use the stash there (mostly to make it faster). But it was not integrated yet.

Am Sa., 29. Dez. 2018, 16:29 hat Nicolas Cellier <[hidden email]> geschrieben:
 
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

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 :)
Reply | Threaded
Open this post in threaded view
|

Re: git-hook considered harmfull!

Nicolas Cellier
 
Jakob you rock!
You solve problems before i ask, that's unbilievabely efficient!
Thanks Tobias and Fabio too!

Le sam. 29 déc. 2018 à 16:48, Nicolas Cellier <[hidden email]> a écrit :
Ah thanks, that sounds great!
but there is a conflict... I need to check.

Le sam. 29 déc. 2018 à 16:37, Jakob Reschke <[hidden email]> a écrit :
 
I openend a pull request with modifications to the hook some months ago. Among other things, it does no longer use the stash there (mostly to make it faster). But it was not integrated yet.

Am Sa., 29. Dez. 2018, 16:29 hat Nicolas Cellier <[hidden email]> geschrieben:
 
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

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 :)