Skip to content

Don't offer adding a trailer in a rebase or a cherry-pick or reverts#105

Merged
khaong merged 2 commits intomainfrom
soph/do-not-offer-trailers-if-rebasing
Jan 27, 2026
Merged

Don't offer adding a trailer in a rebase or a cherry-pick or reverts#105
khaong merged 2 commits intomainfrom
soph/do-not-offer-trailers-if-rebasing

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Jan 26, 2026

Did a long rebase today, and a few commits in between had no trailer, so our hooks offered to add a trailer. This shouldn't be done in context of rebase, revert or cherry-pick


Note

Prevents adding Entire-Checkpoint trailers when Git is replaying commits.

  • Introduces isGitSequenceOperation() to detect rebase-merge, rebase-apply, CHERRY_PICK_HEAD, and REVERT_HEAD using GetGitDir() (supports worktrees)
  • Updates PrepareCommitMsg to no-op with debug logging during these sequence operations
  • Adds tests for detection in clean repos, rebase-merge, rebase-apply, cherry-pick, revert, and worktrees in hooks_test.go

Written by Cursor Bugbot for commit a35d983. This will update automatically on new commits. Configure here.

@Soph Soph requested a review from a team as a code owner January 26, 2026 19:56
Copilot AI review requested due to automatic review settings January 26, 2026 19:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents the CLI from offering to add Entire-Checkpoint trailers during git sequence operations (rebase, cherry-pick, revert). These operations replay existing commits and shouldn't be linked to agent sessions. The implementation adds a detection function that checks for git state files/directories and returns early from PrepareCommitMsg() when such operations are in progress.

Changes:

  • Added isGitSequenceOperation() function to detect rebase/cherry-pick/revert state
  • Modified PrepareCommitMsg() to skip trailer addition during sequence operations
  • Added comprehensive unit tests covering all sequence operation types and worktree scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/entire/cli/strategy/manual_commit_hooks.go Added sequence operation detection and early return in PrepareCommitMsg hook
cmd/entire/cli/strategy/hooks_test.go Added tests for isGitSequenceOperation covering all operation types and worktree edge cases

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Entire-Checkpoint: 87ae9c9a92c1
@khaong khaong merged commit d3a182c into main Jan 27, 2026
4 checks passed
@khaong khaong deleted the soph/do-not-offer-trailers-if-rebasing branch January 27, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants