summaryrefslogtreecommitdiff
path: root/t/t1007-hash-object.sh
diff options
context:
space:
mode:
authorLibravatar Adam Roben <aroben@apple.com>2008-05-23 16:19:38 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-05-23 12:06:35 -0700
commitd8ee4832509dd2d7448a49920f5cba2fc979283d (patch)
tree64f56ec59cef4fc50476208c93aadc705c438c77 /t/t1007-hash-object.sh
parentAdd more tests for git hash-object (diff)
downloadtgif-d8ee4832509dd2d7448a49920f5cba2fc979283d.tar.xz
git-hash-object: Add --stdin-paths option
This allows multiple paths to be specified on stdin. Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1007-hash-object.sh')
-rwxr-xr-xt/t1007-hash-object.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index 2019ea7891..05262954ab 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -52,6 +52,15 @@ test_expect_success "multiple '--stdin's are rejected" '
test_must_fail git hash-object --stdin --stdin < example
'
+test_expect_success "Can't use --stdin and --stdin-paths together" '
+ test_must_fail git hash-object --stdin --stdin-paths &&
+ test_must_fail git hash-object --stdin-paths --stdin
+'
+
+test_expect_success "Can't pass filenames as arguments with --stdin-paths" '
+ test_must_fail git hash-object --stdin-paths hello < example
+'
+
# Behavior
push_repo
@@ -98,4 +107,27 @@ for args in "-w --stdin" "--stdin -w"; do
pop_repo
done
+filenames="hello
+example"
+
+sha1s="$hello_sha1
+$example_sha1"
+
+test_expect_success "hash two files with names on stdin" '
+ test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)"
+'
+
+for args in "-w --stdin-paths" "--stdin-paths -w"; do
+ push_repo
+
+ test_expect_success "hash two files with names on stdin and write to database ($args)" '
+ test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object $args)"
+ '
+
+ test_blob_exists $hello_sha1
+ test_blob_exists $example_sha1
+
+ pop_repo
+done
+
test_done