summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-09-09 14:33:07 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-09-09 14:33:07 -0700
commit24703ead4b9391cbe71ce9978cbffdd6c3ecbaec (patch)
tree87c78fb655f25ac80963ffa0ac21b2f1f10d450d /t
parentMerge branch 'es/blame-L-more' (diff)
parentcat-file: only split on whitespace when %(rest) is used (diff)
downloadtgif-24703ead4b9391cbe71ce9978cbffdd6c3ecbaec.tar.xz
Merge branch 'jk/cat-file-batch-optim'
Rework the reverted change to `cat-file --batch-check`. * jk/cat-file-batch-optim: cat-file: only split on whitespace when %(rest) is used
Diffstat (limited to 't')
-rwxr-xr-xt/t1006-cat-file.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 4e911fb43d..a420742494 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -78,6 +78,13 @@ $content"
echo $sha1 | git cat-file --batch-check="%(objecttype) %(objectname)" >actual &&
test_cmp expect actual
'
+
+ test_expect_success '--batch-check with %(rest)' '
+ echo "$type this is some extra content" >expect &&
+ echo "$sha1 this is some extra content" |
+ git cat-file --batch-check="%(objecttype) %(rest)" >actual &&
+ test_cmp expect actual
+ '
}
hello_content="Hello World"
@@ -91,6 +98,14 @@ test_expect_success "setup" '
run_tests 'blob' $hello_sha1 $hello_size "$hello_content" "$hello_content"
+test_expect_success '--batch-check without %(rest) considers whole line' '
+ echo "$hello_sha1 blob $hello_size" >expect &&
+ git update-index --add --cacheinfo 100644 $hello_sha1 "white space" &&
+ test_when_finished "git update-index --remove \"white space\"" &&
+ echo ":white space" | git cat-file --batch-check >actual &&
+ test_cmp expect actual
+'
+
tree_sha1=$(git write-tree)
tree_size=33
tree_pretty_content="100644 blob $hello_sha1 hello"