From: Sami Jawhar Date: Tue, 17 Nov 2026 06:32:23 GMT Subject: [BUG] combine-diff: wrong deletion columns at 33 parents, no hunks at 64 Message-ID: What did you do before the bug happened? (Steps to reproduce your issue) I ran git diff-tree --cc -U0 on octopus merges with 32, 33, 63 and 64 parents. Save this script as repro.sh: #!/bin/sh # usage: repro.sh N set -eu n=$1 lines=$((10 * n + 20)) dir=octopus-$n rm -rf "$dir" git init -q "$dir" cd "$dir" export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@example.com export GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@example.com file() { # FIRST_LINE SIDE...: "side " goes after line 10*i+10 first=$1; shift echo "$first" k=2 while [ "$k" -le "$lines" ]; do echo "line $k" for side in "$@"; do [ "$k" -eq $((10 * side + 10)) ] && echo "side $side" done k=$((k + 1)) done } commit() { # MESSAGE PARENT... < content blob=$(git hash-object -w --stdin) tree=$(printf '100644 blob %s\tf.txt\n' "$blob" | git mktree) message=$1; shift for parent in "$@"; do set -- "$@" -p "$parent"; shift; done git commit-tree "$tree" "$@" -m "$message" } base=$(file "line 1" | commit base) parents= all= i=0 while [ "$i" -lt "$n" ]; do first="line 1" { [ "$i" -eq 1 ] || [ "$i" -eq $((n - 1)) ]; } && first="removed line" parents="$parents $(file "$first" "$i" | commit "side $i" "$base")" all="$all $i" i=$((i + 1)) done merge=$({ file "line 1" $all; echo "merge-only line"; } | commit octopus $parents) echo "merge of $n parents" echo "lines showing \"merge-only line\":" \ "$(git diff-tree --cc -U0 "$merge" | grep -c 'merge-only line')" git diff-tree --cc -U0 "$merge" | awk -v n="$n" ' function check() { if (!open) return for (p = 1; p <= n; p++) if (got[p] != want[p]) { printf "hunk %s: parent %d: header says %d line(s), body shows %d\n", header, p, want[p], got[p]; bad++ } } /^@@@/ { check(); open = 1; header = $(n + 2); split($0, f, " ") for (p = 1; p <= n; p++) { split(substr(f[p + 1], 2), r, ",") want[p] = (r[2] == "" ? 1 : r[2]); got[p] = 0 } next } open { m = substr($0, 1, n); lost = index(m, "-") > 0 for (p = 1; p <= n; p++) { c = substr(m, p, 1) if (c == "-" || (!lost && c == " ")) got[p]++ } } END { check(); if (!bad) print "every hunk agrees with its header" }' From an empty directory, run: for n in 32 33 63 64; do sh repro.sh "$n" done What did you expect to happen? (Expected behavior) Each hunk body should agree with its header, and "merge-only line" should appear in the diff. What happened instead? (Actual behavior) Git 2.43.0 and master at e1ec09b23c8e print identical output: merge of 32 parents lines showing "merge-only line": 1 every hunk agrees with its header merge of 33 parents lines showing "merge-only line": 1 hunk +1,1: parent 1: header says 1 line(s), body shows 2 merge of 63 parents lines showing "merge-only line": 1 hunk +1,1: parent 31: header says 1 line(s), body shows 2 merge of 64 parents lines showing "merge-only line": 0 every hunk agrees with its header At 64 parents the diff has no hunks, so the script's final "every hunk" message does not indicate success. What's different between what you expected and what actually happened? At 33 parents, "removed line" is present in parents 2 and 33, but the diff marks its deletion in columns 1 and 2. At 63 parents, the line is present in parents 2 and 63, but the diff marks columns 2 and 31. In e1ec09b23c8e, coalesce_lines() at combine-diff.c:249 has: baseend->parent_map |= 1<