reuters-graphics / bluprint_graphics-kit

SvelteKit rig for graphics and newsapps
https://reuters-graphics.github.io/docs_graphics-kit/
21 stars 3 forks source link

Questions about the pre-commit hook #90

Closed man-shar closed 2 years ago

man-shar commented 2 years ago

I've had this issue with a couple projects.

The sequence of events goes something like:

  1. I run git add .

  2. I commit. And the pre-commit hook starts.

    image
  3. It seemingly runs fine and does it thing.

    image
  4. But my git status is back to untracked changes in files.

    image

I usually "solve" this by continue to git-add and commit till my git is all clean post the pre-commit hook.

I guess my primary question is if this is intentional behaviour?

If so, could multiple people working on the same project face merge issues because there's untracked changes after the hook I might be unaware of? (I wouldn't have bothered with a git status after committing if I didn't have the zsh indicator.)

hobbes7878 commented 2 years ago

Weird... You're right!

After I moved us from husky to lefthook for git hooks, apparently the behaviour is different. Lefthook doesn't automatically add changed files to the last commit: https://github.com/evilmartians/lefthook/issues/64

I see a few scattered solutions, so will need to test one and then will add here.

Thanks for out-pointing @man-shar.