Git fork

Merge branch 'jk/add-p-unmerged-fix'

"git add -p" while the index is unmerged sometimes failed to parse
the diff output it internally produces and died, which has been
corrected.

* jk/add-p-unmerged-fix:
add-patch: handle "* Unmerged path" lines

+23 -1
+2 -1
add-patch.c
··· 484 484 if (!eol) 485 485 eol = pend; 486 486 487 - if (starts_with(p, "diff ")) { 487 + if (starts_with(p, "diff ") || 488 + starts_with(p, "* Unmerged path ")) { 488 489 complete_file(marker, hunk); 489 490 ALLOC_GROW_BY(s->file_diff, s->file_diff_nr, 1, 490 491 file_diff_alloc);
+21
t/t3701-add-interactive.sh
··· 1077 1077 test_cmp expect actual 1078 1078 ' 1079 1079 1080 + test_expect_success 'reset -p with unmerged files' ' 1081 + test_when_finished "git checkout --force main" && 1082 + test_commit one conflict && 1083 + git checkout -B side HEAD^ && 1084 + test_commit two conflict && 1085 + test_must_fail git merge one && 1086 + 1087 + # this is a noop with only an unmerged entry 1088 + git reset -p && 1089 + 1090 + # add files that sort before and after unmerged entry 1091 + echo a >a && 1092 + echo z >z && 1093 + git add a z && 1094 + 1095 + # confirm that we can reset those files 1096 + printf "%s\n" y y | git reset -p && 1097 + git diff-index --cached --diff-filter=u HEAD >staged && 1098 + test_must_be_empty staged 1099 + ' 1100 + 1080 1101 test_done