From d8ee4832509dd2d7448a49920f5cba2fc979283d Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Fri, 23 May 2008 16:19:38 +0200 Subject: git-hash-object: Add --stdin-paths option This allows multiple paths to be specified on stdin. Signed-off-by: Adam Roben Signed-off-by: Junio C Hamano --- t/t1007-hash-object.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 't') 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 -- cgit v1.2.1