X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft1007-hash-object.sh;h=f3972a79afe515fb02b3d984c5185e0a723aab1b;hb=39702431500b76425f047209c9e9b2aae7e92b00;hp=05262954abbd5aa054fbde44f946d58e07a54574;hpb=b84c343c885b8168047b2773b5c597d04337d9bd;p=git.git diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index 05262954a..f3972a79a 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description=git-hash-object +test_description="git-hash-object" . ./test-lib.sh @@ -49,16 +49,20 @@ setup_repo # Argument checking test_expect_success "multiple '--stdin's are rejected" ' - test_must_fail git hash-object --stdin --stdin < example + echo example | test_must_fail git hash-object --stdin --stdin ' 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 + echo example | test_must_fail git hash-object --stdin --stdin-paths && + echo example | 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 + echo example | test_must_fail git hash-object --stdin-paths hello +' + +test_expect_success "Can't use --path with --stdin-paths" ' + echo example | test_must_fail git hash-object --stdin-paths --path=foo ' # Behavior @@ -93,6 +97,26 @@ test_expect_success 'git hash-object --stdin file1 file0 && + cp file0 file1 && + echo "file0 -crlf" >.gitattributes && + echo "file1 crlf" >>.gitattributes && + git config core.autocrlf true && + file0_sha=$(git hash-object file0) && + file1_sha=$(git hash-object file1) && + test "$file0_sha" != "$file1_sha" && + path1_sha=$(git hash-object --path=file1 file0) && + path0_sha=$(git hash-object --path=file0 file1) && + test "$file0_sha" = "$path0_sha" && + test "$file1_sha" = "$path1_sha" && + path1_sha=$(cat file0 | git hash-object --path=file1 --stdin) && + path0_sha=$(cat file1 | git hash-object --path=file0 --stdin) && + test "$file0_sha" = "$path0_sha" && + test "$file1_sha" = "$path1_sha" && + git config --unset core.autocrlf +' + pop_repo for args in "-w --stdin" "--stdin -w"; do