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>
This commit is contained in:

committed by
Junio C Hamano

parent
3ea5a1b33d
commit
d8ee483250
@ -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
|
||||
|
Reference in New Issue
Block a user