git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* post-checkout hook aborts rebase
@ 2020-08-26 23:10 Tom Rutherford
  2020-08-27  0:13 ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Rutherford @ 2020-08-26 23:10 UTC (permalink / raw)
  To: git

Hi Git community,

My team encountered an issue today which I believe is a bug, and I'm
interested to know if those more familiar with the codebase and
documentation agree with me. Here's a bug report. Thanks for your
attention.

Tom

===

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

1. Have a post-checkout hook that returns a nonzero exit status.
2. `git pull --rebase` where there is at least one local commit to be
rebased onto an incoming commit. (I assume any rebase would exhibit
similar behavior, but this is how I encountered the issue).

What did you expect to happen? (Expected behavior)

The rebase succeeds.

I expect this because the documentation for the post-checkout hook
states, "This hook cannot affect the outcome of git switch or git
checkout" https://www.git-scm.com/docs/githooks#_post_checkout

What happened instead? (Actual behavior)

`error: could not detach HEAD` is displayed, and I end up in a
detached head state.

What's different between what you expected and what actually happened?

I do not expect the post-checkout hook to prevent rebase from
succeeding. The documentation suggests this should succeed. It seems
either the documentation is wrong, or git's use of the hook is in this
case.

Anything else you want to add:

The issue is elegantly explained in this stack overflow answer:
https://stackoverflow.com/a/25562688/1286571

It's not clear to me if this is a bug, or an omission from the
documentation. I reproduced it on 2.28, but I haven't tried building
from source.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.28.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10
07:21:24 UTC 2020 x86_64
compiler info: gnuc: 7.5
libc info: glibc: 2.27
$SHELL (typically, interactive shell): /usr/bin/fish


[Enabled Hooks]
pre-commit
post-checkout

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-09-12  0:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 23:10 post-checkout hook aborts rebase Tom Rutherford
2020-08-27  0:13 ` Junio C Hamano
2020-08-27  0:22   ` Junio C Hamano
2020-08-27  0:44     ` Tom Rutherford
2020-08-27  5:44       ` Chris Torek
2020-08-27 15:51         ` Junio C Hamano
2020-08-27 19:04           ` Chris Torek
2020-08-27 20:11             ` Elijah Newren
2020-08-27 20:32               ` Chris Torek
2020-09-09  9:43       ` Phillip Wood
2020-09-09 16:07         ` Tom Rutherford
2020-09-11 20:25         ` Philippe Blain
2020-09-12  0:51           ` Junio C Hamano
2020-08-27 16:27     ` Elijah Newren
2020-08-27 17:27       ` Junio C Hamano
2020-08-27 17:47         ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).