Skip to content

Commit 8d48950

Browse files
committed
cherry-pick: demonstrate a segmentation fault
In #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 <[email protected]>
1 parent 58e7864 commit 8d48950

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t3501-revert-cherry-pick.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,16 @@ test_expect_success 'cherry-pick "-" works with arguments' '
141141
test_cmp expect actual
142142
'
143143

144+
test_expect_failure 'cherry-pick works with dirty renamed file' '
145+
test_commit to-rename &&
146+
git checkout -b unrelated &&
147+
test_commit unrelated &&
148+
git checkout @{-1} &&
149+
git mv to-rename.t renamed &&
150+
test_tick &&
151+
git commit -m renamed &&
152+
echo modified >renamed &&
153+
git cherry-pick refs/heads/unrelated
154+
'
155+
144156
test_done

0 commit comments

Comments
 (0)