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

git hook post-checkout does not work as expected #3241

Closed
nkhdiscovery opened this issue Jan 27, 2020 · 3 comments · Fixed by #3253
Closed

git hook post-checkout does not work as expected #3241

nkhdiscovery opened this issue Jan 27, 2020 · 3 comments · Fixed by #3253
Assignees
Labels
bug Did we break something? p0-critical Critical issue. Needs to be fixed ASAP.

Comments

@nkhdiscovery
Copy link

Hi,
The best procedure to reproduce the bug is following step 4 of basic scenarios, versioning:
https://katacoda.com/dvc/courses/basics/versioning

It is expected that git checkout automatically triggers dvc checkout so the file.txt is restored to proper version which was committed, but it does not and cat file.txt gives test 3 after every checkout. dvc install has successfully installed the hooks, I checked, but I do not know if the tutorial is wrong or the hook is not working properly.

@triage-new-issues triage-new-issues bot added the triage Needs to be triaged label Jan 27, 2020
@shcheklein
Copy link
Member

Yep, was able to reproduce. It can be skipped to the step 4 directly to reproduce this.

@efiop efiop added the bug Did we break something? label Jan 27, 2020
@triage-new-issues triage-new-issues bot removed the triage Needs to be triaged label Jan 27, 2020
@efiop efiop added p0-critical Critical issue. Needs to be fixed ASAP. triage Needs to be triaged labels Jan 27, 2020
@triage-new-issues triage-new-issues bot removed the triage Needs to be triaged label Jan 27, 2020
@nkhdiscovery
Copy link
Author

@shcheklein Thanks for approval.

@efiop
Copy link
Contributor

efiop commented Jan 28, 2020

For the record, it is caused by my recent change to post-checkout hook, which accounted for branches but didn't account for tags properly 🙁 I will look into it soon. Thanks for the feedback!

@efiop efiop self-assigned this Jan 28, 2020
@efiop efiop removed their assignment Jan 28, 2020
@efiop efiop self-assigned this Jan 29, 2020
efiop added a commit to efiop/dvc that referenced this issue Jan 30, 2020
We should skip running post-checkout hook on rebases and merges to not
accidentally break them in the middle of the process. Git doesn't
provide any native mechanisms for hooks to know whether or not this is a
rebase/merge that we are going through, but we can use
`.git/rebase-merge` existance as a marker.

Previous approach has only accounted for branches and was causing issues
when checking-out tags.

Fixes iterative#3241
efiop added a commit to efiop/dvc that referenced this issue Jan 30, 2020
We should skip running post-checkout hook on rebases and merges to not
accidentally break them in the middle of the process. Git doesn't
provide any native mechanisms for hooks to know whether or not this is a
rebase/merge that we are going through, but we can use
`.git/rebase-merge` existance as a marker.

Previous approach has only accounted for branches and was causing issues
when checking-out tags.

Fixes iterative#3241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Did we break something? p0-critical Critical issue. Needs to be fixed ASAP.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants