Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only check staged content in pre-hooks #916

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Emilgardis
Copy link
Member

No description provided.

@Emilgardis Emilgardis force-pushed the hook-stash branch 4 times, most recently from 1ded0d8 to 4aa88c0 Compare July 6, 2022 13:56
@Emilgardis Emilgardis added the no changelog A valid PR without changelog (no-changelog) label Jul 6, 2022
@Emilgardis Emilgardis marked this pull request as ready for review July 6, 2022 14:02
@Emilgardis Emilgardis requested a review from a team as a code owner July 6, 2022 14:02
git diff --full-index --binary > "$tf"
git stash -q --keep-index

trap cleanup EXIT
Copy link
Contributor

@Alexhuszagh Alexhuszagh Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work on SIGKILL or SIGSTOP, which would lead to data lost. It also doesn't work for new files, which would mean they would be tests but not staged. There probably needs to be some means of recover (consistent file naming, a script to undo the last action in the Git history, something).

Copy link
Contributor

@Alexhuszagh Alexhuszagh Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple example is:

$ echo "Sample contents" > file
$ git diff --full-index --binary # no output
$ git stash -q --keep-index      # doesn't stash anything

@Emilgardis Emilgardis marked this pull request as draft July 9, 2022 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog A valid PR without changelog (no-changelog)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants