sparse checkout: show error messages when worktree shaping fails

verify_* functions can queue errors up and to be printed later at
label return_failed. In case of errors, do not go to label "done"
directly because all queued messages would be dropped on the floor.

Found-by: Joshua Jensen <jjensen@workspacewhiz.com>
Tracked-down-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2011-09-22 21:24:22 +10:00
committed by Junio C Hamano
parent f696543dad
commit 17d26a4d04
2 changed files with 25 additions and 3 deletions

View File

@ -234,4 +234,19 @@ test_expect_success 'read-tree --reset removes outside worktree' '
test_cmp empty result
'
test_expect_success 'print errors when failed to update worktree' '
echo sub >.git/info/sparse-checkout &&
git checkout -f init &&
mkdir sub &&
touch sub/added sub/addedtoo &&
test_must_fail git checkout top 2>actual &&
cat >expected <<\EOF &&
error: The following untracked working tree files would be overwritten by checkout:
sub/added
sub/addedtoo
Please move or remove them before you can switch branches.
EOF
test_cmp expected actual
'
test_done