Skip to content

Conversation

@fallion
Copy link
Member

@fallion fallion commented Dec 4, 2025

Important

Handle detached HEAD state in Git operations and add corresponding tests.

  • Behavior:
    • CurrentBranch() in current_branch.go now returns 'HEAD' as the branch name in detached HEAD state.
    • BranchDiffCommits, CommitsBetween, CommitsOnBranch, and LatestCommitOnBranch functions now handle detached HEAD state correctly.
  • Tests:
    • Added TestCurrentBranchDetachedHead in current_branch_test.go to verify behavior in detached HEAD state.
    • Added TestBranchDiffCommitsDetachedHead in branch_diff_commits_test.go to test BranchDiffCommits with detached HEAD.
    • Added TestCommitsBetweenDetachedHead in commits_between_test.go to test CommitsBetween with detached HEAD.
    • Added TestCommitsOnBranchDetachedHead in commits_on_branch_test.go to test CommitsOnBranch with detached HEAD.
    • Added TestLatestCommitOnBranchDetachedHead in latest_commit_on_branch_test.go to test LatestCommitOnBranch with detached HEAD.
  • Misc:
    • Added detached_head.bundle to testdata and updated setup_test_repos.sh to include it.

This description was created by Ellipsis for 9808baf. You can customize this summary. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 9808baf in 1 minute and 31 seconds. Click for details.
  • Reviewed 217 lines of code in 9 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. branch_diff_commits_test.go:37
  • Draft comment:
    Consider using assert.NoError(t, err) consistently instead of assert.Equal(t, err, nil) for clearer error assertions.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. current_branch.go:18
  • Draft comment:
    Consider trimming the output from runGitCommand (e.g. for symbolic-ref) to avoid inadvertent whitespace issues in branch names.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
3. testdata/setup_test_repos.sh:5
  • Draft comment:
    The echo message mentions 'commits_on_branch_test' while the clone is done into 'commits_on_branch'; updating this for clarity is recommended.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None

Workflow ID: wflow_iydCxHEZjPeBtS2s

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@fallion fallion merged commit d1b57e4 into master Dec 4, 2025
8 checks passed
@fallion fallion deleted the detached-head branch December 4, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants