server icon indicating copy to clipboard operation
server copied to clipboard

pre-commit-hooks moves changes into other changelist

Open BlackYps opened this issue 3 years ago • 6 comments

Not sure if this is a general issue or due to our configuration, but everytime I commit, or try to commit I have to sort my files back into their changelists. I have made changes and sorted them into multiple changelists. Every time the pre commit hooks run all my changed files are put in the active changelist and I have to move them back manually which is annoying as hell.

BlackYps avatar Oct 11 '21 16:10 BlackYps

I’m not quite sure what you mean by “changelist”. I also haven’t tried out the pre-commit hooks, I just made sure they installed before merging the PR from @Gatsik.

Askaholic avatar Oct 11 '21 17:10 Askaholic

I just learned that it is an Intellij feature and it is not a git feature. Basically it lets you split the indexed changes into logical subsets. grafik Now that we know that it is not a git feature, I am really wondering how the pre-commit feature can mess it up...

BlackYps avatar Oct 11 '21 19:10 BlackYps

Huh weird. Well if it’s using the git index file somehow then maybe pre-commit it is messing with that.

Askaholic avatar Oct 11 '21 20:10 Askaholic

I don't think this is the server issue, moreover, I don't think this is the pre-commit or Intellij IDEA issue either, it's just the way you work with the version control system. I think it happens because pre-commit stashes all the changes before running its checks, and at that moment Intellij thinks that work is done (probably, I have never used Intellij IDEA and changelists).

Gatsik avatar Oct 21 '21 20:10 Gatsik

That indeed sounds like the stash is the issue. Seems like when stashing the changes, the information which changelist a change belongs to gets lost. Do pre-commit hooks always stash the changes, or is that based on how they are configured? I'll try to find more information on the internet, because if this is a general issue there must be others with the problem too (and hopefully some solutions).

BlackYps avatar Oct 22 '21 13:10 BlackYps

Yes, pre-commit always stashes the changes (link)

Gatsik avatar Oct 22 '21 17:10 Gatsik