Skip to content

Commit f8acb80

Browse files
committed
t3507: add a testcase showing failure with sparse checkout
Recent changes in merge_content() induced a bug when merging files that are not present in the local working directory due to sparse-checkout. Add a test case to demonstrate the bug so that we can ensure the fix resolves it and to prevent future regressions. Signed-off-by: Ben Peart <[email protected]> Signed-off-by: Elijah Newren <[email protected]>
1 parent 7f0582a commit f8acb80

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t3507-cherry-pick-conflict.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,4 +392,17 @@ test_expect_success 'commit --amend -s places the sign-off at the right place' '
392392
test_cmp expect actual
393393
'
394394

395+
test_expect_failure 'cherry-pick preserves sparse-checkout' '
396+
pristine_detach initial &&
397+
test_config core.sparseCheckout true &&
398+
test_when_finished "
399+
echo \"/*\" >.git/info/sparse-checkout
400+
git read-tree --reset -u HEAD
401+
rm .git/info/sparse-checkout" &&
402+
echo /unrelated >.git/info/sparse-checkout &&
403+
git read-tree --reset -u HEAD &&
404+
test_must_fail git cherry-pick -Xours picked>actual &&
405+
test_i18ngrep ! "Changes not staged for commit:" actual
406+
'
407+
395408
test_done

0 commit comments

Comments
 (0)