git-branchless icon indicating copy to clipboard operation
git-branchless copied to clipboard

Add automatic warning when hooks not installed

Open Kimeiga opened this issue 1 year ago • 3 comments

Description of the bug

https://pastebin.com/Qsurfkdb

I don't have a minimal example of this yet but

i just ran git sl

and then git sync --merge -p

and then it duplicated all of the commits while rebasing them

so now i have to go manually hide all of these

This happens all the time whenever I rebase with git sync, and I have no idea why. Have you seen this before and do you know what I can try to see if I can fix this? I can try to recreate a minimal repeatable example but I feel like you must have seen this before.

here is my .gitconfig https://pastebin.com/NS92fzZU

and my git.plugin.zsh that I don't really use but here anyways: https://pastebin.com/DfdndaCd

Expected behavior

I expected git sync -p --merge to just rebase the branches normally and not duplicate the commits

Actual behavior

it duplicates the commits whenever it rebases

Version of rustc

rustc 1.78.0 (9b00956e5 2024-04-29)

Automated bug report

Software version

git-branchless 0.9.0

Operating system

macOS 14.6.1 (Darwin 23.6.0)

Command-line

/Users/hakan.alpay/.cargo/bin/git-branchless bug-report 

Environment variables

SHELL=/bin/zsh
EDITOR=nvim

Git version

> git version 
git version 2.39.3 (Apple Git-146)

Hooks

Show 7 hooks
Hook post-applypatch
<not found>
<missing newline>
Hook post-checkout
<not found>
<missing newline>
Hook post-commit
<not found>
<missing newline>
Hook post-merge
<not found>
<missing newline>
Hook post-rewrite
<not found>
<missing newline>
Hook pre-auto-gc
<not found>
<missing newline>
Hook reference-transaction
<not found>
<missing newline>

Events

Show 5 events
Event ID: 22754, transaction ID: 11343 (message: sync)
  1. WorkingCopySnapshot { timestamp: 1725374235.616942, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
  2. WorkingCopySnapshot { timestamp: 1725374235.953443, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
  3. WorkingCopySnapshot { timestamp: 1725374236.158518, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
  4. WorkingCopySnapshot { timestamp: 1725374236.392196, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
  5. WorkingCopySnapshot { timestamp: 1725374236.620205, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
  6. WorkingCopySnapshot { timestamp: 1725374236.847421, event_tx_id: Id(11343), head_oid: 3178a38f424c002fc576e029f777421d297cf149, commit_oid: NonZeroOid(cdd43e7449ee0955112aae2df087009a0458c608), ref_name: None }
:
O e257cf4 3d xxxxx xxxxxx xxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|\
| o 9180a43 3d xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 9f5ef18 3d xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 39061c6 3d xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o b887061 3d xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o ddc5a4ed 3d xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o eba5182 3d xxxx
|\
: o 3178a38 3d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
:
O 62d4816 4h (master) xxxx xxxxxxxx xxxxx xxx
|\
| o 0ba8df5 15m (redacted-ref-0) xxxx
|\
| o 21a0cd4 15m (redacted-ref-1) xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o 65d95b0 15m (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 810a520 15m (redacted-ref-3) xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 418640d 15m (redacted-ref-4) xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o 8ded633 15m (redacted-ref-5) xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|
@ 99db02a 15m (redacted-ref-6) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Event ID: 22753, transaction ID: 11341 (message: checkout)
  1. WorkingCopySnapshot { timestamp: 1725049301.841517, event_tx_id: Id(11341), head_oid: 88de89cd275c6d6f3b11e69e59b813deb2bcf8d2, commit_oid: NonZeroOid(29016a173f98514177eb300f0a4530eb041abfd6), ref_name: Some(ReferenceName("refs/heads/redacted-ref-4")) }
:
O e257cf4 3d xxxxx xxxxxx xxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|\
| o 9180a43 3d xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 9f5ef18 3d xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 39061c6 3d xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o b887061 3d xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o ddc5a4ed 3d xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o eba5182 3d xxxx
|\
: o 3178a38 3d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
:
O 62d4816 4h (master) xxxx xxxxxxxx xxxxx xxx
|\
| o 0ba8df5 15m (redacted-ref-0) xxxx
|\
| o 21a0cd4 15m (redacted-ref-1) xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o 65d95b0 15m (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 810a520 15m (redacted-ref-3) xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 418640d 15m (redacted-ref-4) xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o 8ded633 15m (redacted-ref-5) xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|
@ 99db02a 15m (redacted-ref-6) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Event ID: 22752, transaction ID: 11336 (message: checkout)
  1. WorkingCopySnapshot { timestamp: 1725048218.668019, event_tx_id: Id(11336), head_oid: e257cf479317e574aaa8762c855d28cdd26dce4b, commit_oid: NonZeroOid(abeaa217b92b878544817ae4d057b5b0749ece98), ref_name: Some(ReferenceName("refs/heads/master")) }
:
O e257cf4 3d xxxxx xxxxxx xxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|\
| o 9180a43 3d xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 9f5ef18 3d xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 39061c6 3d xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o b887061 3d xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o ddc5a4ed 3d xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o eba5182 3d xxxx
|\
: o 3178a38 3d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
:
O 62d4816 4h (master) xxxx xxxxxxxx xxxxx xxx
|\
| o 0ba8df5 15m (redacted-ref-0) xxxx
|\
| o 21a0cd4 15m (redacted-ref-1) xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o 65d95b0 15m (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 810a520 15m (redacted-ref-3) xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 418640d 15m (redacted-ref-4) xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o 8ded633 15m (redacted-ref-5) xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|
@ 99db02a 15m (redacted-ref-6) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Event ID: 22751, transaction ID: 11335 (message: checkout)
  1. WorkingCopySnapshot { timestamp: 1725046176.369339, event_tx_id: Id(11335), head_oid: 9f5ef1870d1f43cc09cae1b28d4a8af47527be91, commit_oid: NonZeroOid(bf7ea8912f1005143fba3cb8957b3605ff5ca63c), ref_name: Some(ReferenceName("refs/heads/redacted-ref-3")) }
:
O e257cf4 3d xxxxx xxxxxx xxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|\
| o 9180a43 3d xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 9f5ef18 3d xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 39061c6 3d xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o b887061 3d xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o ddc5a4ed 3d xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o eba5182 3d xxxx
|\
: o 3178a38 3d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
:
O 62d4816 4h (master) xxxx xxxxxxxx xxxxx xxx
|\
| o 0ba8df5 15m (redacted-ref-0) xxxx
|\
| o 21a0cd4 15m (redacted-ref-1) xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o 65d95b0 15m (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 810a520 15m (redacted-ref-3) xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 418640d 15m (redacted-ref-4) xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o 8ded633 15m (redacted-ref-5) xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|
@ 99db02a 15m (redacted-ref-6) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Event ID: 22750, transaction ID: 11334 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1725043530.37901, event_tx_id: Id(11334), ref_name: ReferenceName("refs/remotes/redacted-ref-7"), old_oid: dcb0e4e3b7f453a87e22b07094ae9dcbbde3ecc0, new_oid: 00b85cd465181369f3ad6fbc7e5fc98972cd06d7, message: None }
:
O e257cf4 3d xxxxx xxxxxx xxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|\
| o 9180a43 3d xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 9f5ef18 3d xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 39061c6 3d xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o b887061 3d xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o ddc5a4ed 3d xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o eba5182 3d xxxx
|\
: o 3178a38 3d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
:
O 62d4816 4h (master) xxxx xxxxxxxx xxxxx xxx
|\
| o 0ba8df5 15m (redacted-ref-0) xxxx
|\
| o 21a0cd4 15m (redacted-ref-1) xxxxxxxxx xxxxxxxxxx xxxx xxxxxxxx xxxxx xxxxxxxx xxx xxx
|\
| o 65d95b0 15m (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxx xxxx xxxx xxx xxx
|\
| o 810a520 15m (redacted-ref-3) xxxxxxxx xxx xxxxx xxx xxxxxxxxxx xx xxxxx xxxx
| |
| o 418640d 15m (redacted-ref-4) xxxxxxxx xxx xxxxx xxxxxxxxxx xxxx xx xxxxxx xxxxx
|\
| o 8ded633 15m (redacted-ref-5) xxxxxxxxxxxxxxxxxxx xxxxxxx xxxx xxxx xxx xxx
|
@ 99db02a 15m (redacted-ref-6) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Version of git-branchless

No response

Version of git

No response

Kimeiga avatar Sep 03 '24 14:09 Kimeiga

I just removed rebase update refs from my gitconfig and now i think it might be working, but i'll update if i see any other weird behavior

https://pastebin.com/6537aLsV

I wonder why this is happening, maybe update refs is competing with git branchless to move the commits?

Kimeiga avatar Sep 03 '24 15:09 Kimeiga

Hi @Kimeiga, it looks like you don't have any of the expected Git hooks installed. Did you run git branchless init in this repo?

git move can be used without running init, and it will behave more or less as expected if you're using it with the normal suite of Git tools, but git-branchless itself relies on the post-rewrite hook to know that it should hide the old versions of the commits, which will still show up in the smartlog.

Possibly the real remediation here is to make it more obvious when Git hooks might not be installed properly. There should certainly be an auxiliary warning when running bug-report (many people have misconfigured hooks and aliases). It might also be worth including a general health check in the smartlog output.

arxanas avatar Oct 07 '24 12:10 arxanas

I also got into a state where my hooks were not installed after an aborted attempt to use husky that I forgot about. A warning might have saved me some pain.

JamieEi avatar May 02 '25 21:05 JamieEi