summaryrefslogtreecommitdiff
path: root/t/t2030-unresolve-info.sh
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2013-04-04 20:41:43 +0200
committerJunio C Hamano <gitster@pobox.com>2013-04-04 12:27:28 -0700
commitb9e31f59478eeae3e4230308f6fc06713c6fc547 (patch)
tree8efa207ccba7125535840a5dc6a90c601c8701dc /t/t2030-unresolve-info.sh
parent53d8afafbbf455d24b0a94e4114709a4d495d460 (diff)
downloadgit-b9e31f59478eeae3e4230308f6fc06713c6fc547.tar.gz
rerere forget: do not segfault if not all stages are present
The loop that fills in the buffers that are later passed to the merge driver exits early when not all stages of a path are present in the index. But since the buffer pointers are not initialized in advance, the subsequent accesses are undefined. Initialize buffer pointers in advance to avoid undefined behavior later. That is not sufficient, though, to get correct operation of handle_cache(). The function replays a conflicted merge to extract the part inside the conflict markers. As written, the loop exits early when a stage is missing. Consequently, the buffers for later stages that would be present in the index are not filled in and the merge is replayed with incomplete data. Fix it by investigating all stages of the given path. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2030-unresolve-info.sh')
-rwxr-xr-xt/t2030-unresolve-info.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh
index 0b699f50dd..309199bca2 100755
--- a/t/t2030-unresolve-info.sh
+++ b/t/t2030-unresolve-info.sh
@@ -54,8 +54,11 @@ test_expect_success setup '
test_commit second fi/le second &&
git checkout side &&
test_commit third fi/le third &&
+ git branch add-add &&
git checkout another &&
test_commit fourth fi/le fourth &&
+ git checkout add-add &&
+ test_commit fifth add-differently &&
git checkout master
'
@@ -179,4 +182,14 @@ test_expect_success 'rerere forget (binary)' '
git rerere forget binary
'
+test_expect_success 'rerere forget (add-add conflict)' '
+ git checkout -f master &&
+ echo master >add-differently &&
+ git add add-differently &&
+ git commit -m "add differently" &&
+ test_must_fail git merge fifth &&
+ git rerere forget add-differently 2>actual &&
+ test_i18ngrep "no remembered" actual
+'
+
test_done