Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-02-26 03:43:30 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-26 03:43:30 +0300
commit3da165ca289efd84ed648a4b87b7d9ed675937c2 (patch)
tree29b1c07ef2d0d5f308b31a137050013dd8393598 /t
parentf47c3328effa3016fff5d67ac233ac139ce32525 (diff)
parent3f7ba603500a5dec43a062da5235c69e10d29da6 (diff)
Merge branch 'mt/checkout-index-corner-cases'
The error codepath around the "--temp/--prefix" feature of "git checkout-index" has been improved. * mt/checkout-index-corner-cases: checkout-index: omit entries with no tempname from --temp output write_entry(): fix misuses of `path` in error messages
Diffstat (limited to 't')
-rwxr-xr-xt/t2006-checkout-index-basic.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index 8e181dbf01..7ff3edab05 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -32,4 +32,27 @@ test_expect_success 'checkout-index reports errors (stdin)' '
test_i18ngrep not.in.the.cache stderr
'
+test_expect_success 'checkout-index --temp correctly reports error on missing blobs' '
+ test_when_finished git reset --hard &&
+ missing_blob=$(echo "no such blob here" | git hash-object --stdin) &&
+ cat >objs <<-EOF &&
+ 100644 $missing_blob file
+ 120000 $missing_blob symlink
+ EOF
+ git update-index --index-info <objs &&
+
+ test_must_fail git checkout-index --temp symlink file 2>stderr &&
+ test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr &&
+ test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr
+'
+
+test_expect_success 'checkout-index --temp correctly reports error for submodules' '
+ git init sub &&
+ test_commit -C sub file &&
+ git submodule add ./sub &&
+ git commit -m sub &&
+ test_must_fail git checkout-index --temp sub 2>stderr &&
+ test_i18ngrep "cannot create temporary submodule sub" stderr
+'
+
test_done