post-checkout hook aborts rebase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux