Merge branch 'tr/maint-mailinfo'
[gitweb.git] / t / t1011-read-tree-sparse-checkout.sh
index 018c3546b6f05228a20dfb5ec9364d0a1575e4ff..5c0053a20bf2fbf1dd466ace5dc933e38ce3544d 100755 (executable)
@@ -234,4 +234,20 @@ 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.
+Aborting
+EOF
+       test_cmp expected actual
+'
+
 test_done