Skip to content

merge_trees: identical add/add on both sides reported as Err(Unknown) #2968

Description

Identical add/add on both sides reported as Err(Unknown) in multi-file tree merge

Crate: gix-merge 0.20.1 (via gix 0.87.1)

When both sides of a three-way tree merge add the same path with the
byte-identical blob, merge_trees reports the entry as Err(Unknown)
instead of auto-resolving. Git merges the identical inputs cleanly.

Observed entry

ours=Addition {
  location: "examples/resources/repository_private_vulnerability_reporting/example_1.tf",
  entry_mode: 100644,
  id: 049444c2236ddc48c12ac711498a17fb04629d83,   // same blob
}
theirs=Addition {
  location: "examples/resources/repository_private_vulnerability_reporting/example_1.tf",
  entry_mode: 100644,
  id: 049444c2236ddc48c12ac711498a17fb04629d83,   // same blob
}
resolution=Err(Unknown)

Full-fidelity reproduction (git side is clean)

All SHAs are public and immutable (jonathanmorley/terraform-provider-github, branches sharing history with integrations/terraform-provider-github@main):

git clone --bare https://github.com/jonathanmorley/terraform-provider-github.git repro.git
cd repro.git
git fetch https://github.com/integrations/terraform-provider-github.git \
  "refs/heads/main:refs/heads/upstream-main"

# ancestor = merge-base, ours = patch-0 tip, theirs = patch-1 tip:
git merge-tree 3ac346fdfbee2e19589a6203b20d936189ba0760 \
  f1beca348f4beb80688c0046aec6cbfb4c435596 \
  2b8bcab30cc83260154dce6a885a29cb17e6ffcf
# => exit 0, no conflict markers

The same ancestor/ours/theirs through Repository::merge_trees (default
tree_merge_options) yields the Err(Unknown) above (plus an auto-resolved
content merge, which is expected per the Outcome::conflicts docs and is
not part of this report).

What was ruled out

  • Single-file identical-add is clean. Ancestor empty (or holding an
    unrelated file), both sides adding the same file and blob: zero conflicts
    listed, with and without rename tracking. The trigger needs multi-file
    context — the live entries carried differing ChildOfParent directory
    relations ((2) vs (3)), suggesting directory-level rename pairing
    sweeps the agreed file into Unknown.
  • Rename toggle is not the (whole) story. Options::with_rewrites(None)
    does not change the outcome on the live inputs.
  • Not this report: auto-resolved entries appearing in conflicts is
    documented behavior; only the identical-add Err(Unknown) is reported.

Repro materials

Full writeup, the three adjacent blob states, and exact commands:
https://github.com/jonathanmorley/reproductions/tree/gix/merge-identical-add-unknown

Minimal trigger: open

A single-file synthetic repro does not trigger it; the exact minimal
conditions (tree size? directory similarity? relation state?) are
unestablished. Happy to help minimize further given pointers on where to
look in the rename/conflict-classification path.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions