Skip to content

Read an Octopus, a Squash, and the Downstream Hook Snippets Against the Merged-In Parent Too #2141

Closed

Description

@ptr727

Problem

The fix for #2116 has the hub's .husky/pre-commit pass --diff MERGE_HEAD to the prose gate when MERGE_HEAD resolves. Three neighboring cases still read a merged-in parent's lines as added, so comment-added can refuse a comment another pull request already landed.

  1. An octopus merge stopped with --no-commit. git rev-parse --verify MERGE_HEAD returns only the first head MERGE_HEAD lists, so the lines every later head brought still read as added. A conflicted octopus never reaches the hook, since git aborts it and leaves no MERGE_HEAD.
  2. A conflicted git merge --squash, then committed. A squash writes no MERGE_HEAD, so the hook keeps --diff HEAD and reads everything the squashed branch brought as added.
  3. The downstream snippets. catalog/snippets/husky/pre-commit and catalog/snippets/pre-commit/.pre-commit-config.yaml still pass --diff HEAD through hub-fetch-run.py on every commit, a merge commit included, so a downstream repository meets Measure a Merge Commit's Prose Against Its Merged-In Parent in the Pre-Commit Hook #2116 unchanged.

Reproduce (constructed)

For case 1, on a feature branch, git merge --no-commit side develop where develop gained a comment line since the fork, then git commit. The hook refuses that comment. For case 2, git merge --squash develop with a conflict, resolve it, then git commit. The hook refuses the same comment.

Done looks like

Each case either measures only the lines the branch and the resolution introduce, or is stated as out of scope where the hook's scope is described. The snippets choice (an sh -c wrapper in the pre-commit framework entry, or hub-fetch-run.py rewriting the --diff HEAD pair the way it already does when HEAD does not exist) is a choice between approaches rather than one the issue settles.

Activity

  1. added
    bug
    gate
    pre-existing
    on Sep 30, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggatepre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions