]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cherry-pick: demonstrate a segmentation fault
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 26 Nov 2016 12:48:02 +0000 (13:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Nov 2016 18:46:28 +0000 (10:46 -0800)
In https://github.com/git-for-windows/git/issues/952, a complicated
scenario was described that leads to a segmentation fault in
cherry-pick.

It boils down to a certain code path involving a renamed file that is
dirty, for which `refresh_cache_entry()` returns `NULL`, and that
`NULL` not being handled properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3501-revert-cherry-pick.sh

index 51f3bbb8af446dd24a835a8593475b59a73f6d1f..5bef564ff15d5e7c8e35cf1d085191faf319e84c 100755 (executable)
@@ -141,4 +141,16 @@ test_expect_success 'cherry-pick "-" works with arguments' '
        test_cmp expect actual
 '
 
+test_expect_failure 'cherry-pick works with dirty renamed file' '
+       test_commit to-rename &&
+       git checkout -b unrelated &&
+       test_commit unrelated &&
+       git checkout @{-1} &&
+       git mv to-rename.t renamed &&
+       test_tick &&
+       git commit -m renamed &&
+       echo modified >renamed &&
+       git cherry-pick refs/heads/unrelated
+'
+
 test_done