X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=t%2Ft1007-hash-object.sh;h=64b340f227274c28f00a564a682f2369a7b85d8d;hb=f45f88b2e483649cd063a7dc7826c03025683e56;hp=7099d33508a0571cd8f960fcd80c46e4364f1766;hpb=39521d07bedc4a8f1f8891ff1bc0a5b34213504f;p=thirdparty%2Fgit.git diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index 7099d33508..64b340f227 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -9,22 +9,19 @@ echo_without_newline() { } test_blob_does_not_exist() { - test_expect_success SHA1 'blob does not exist in database' " + test_expect_success 'blob does not exist in database' " test_must_fail git cat-file blob $1 " } test_blob_exists() { - test_expect_success SHA1 'blob exists in database' " + test_expect_success 'blob exists in database' " git cat-file blob $1 " } hello_content="Hello World" -hello_sha1=5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689 - example_content="This is an example" -example_sha1=ddd3f836d3e3fbb7ae289aa9ae83536f76956399 setup_repo() { echo_without_newline "$hello_content" > hello @@ -44,7 +41,16 @@ pop_repo() { rm -rf $test_repo } -setup_repo +test_expect_success 'setup' ' + setup_repo && + test_oid_cache <<-EOF + hello sha1:5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689 + hello sha256:1e3b6c04d2eeb2b3e45c8a330445404c0b7cc7b257e2b097167d26f5230090c4 + + example sha1:ddd3f836d3e3fbb7ae289aa9ae83536f76956399 + example sha256:b44fe1fe65589848253737db859bd490453510719d7424daab03daf0767b85ae + EOF +' # Argument checking @@ -73,23 +79,23 @@ test_expect_success "Can't use --path with --no-filters" ' push_repo -test_expect_success SHA1 'hash a file' ' - test $hello_sha1 = $(git hash-object hello) +test_expect_success 'hash a file' ' + test "$(test_oid hello)" = $(git hash-object hello) ' -test_blob_does_not_exist $hello_sha1 +test_blob_does_not_exist "$(test_oid hello)" -test_expect_success SHA1 'hash from stdin' ' - test $example_sha1 = $(git hash-object --stdin < example) +test_expect_success 'hash from stdin' ' + test "$(test_oid example)" = $(git hash-object --stdin < example) ' -test_blob_does_not_exist $example_sha1 +test_blob_does_not_exist "$(test_oid example)" -test_expect_success SHA1 'hash a file and write to database' ' - test $hello_sha1 = $(git hash-object -w hello) +test_expect_success 'hash a file and write to database' ' + test "$(test_oid hello)" = $(git hash-object -w hello) ' -test_blob_exists $hello_sha1 +test_blob_exists "$(test_oid hello)" test_expect_success 'git hash-object --stdin file1 file1 && @@ -161,11 +167,11 @@ pop_repo for args in "-w --stdin" "--stdin -w"; do push_repo - test_expect_success SHA1 "hash from stdin and write to database ($args)" ' - test $example_sha1 = $(git hash-object $args < example) + test_expect_success "hash from stdin and write to database ($args)" ' + test "$(test_oid example)" = $(git hash-object $args < example) ' - test_blob_exists $example_sha1 + test_blob_exists "$(test_oid example)" pop_repo done @@ -173,22 +179,22 @@ done filenames="hello example" -sha1s="$hello_sha1 -$example_sha1" +oids="$(test_oid hello) +$(test_oid example)" -test_expect_success SHA1 "hash two files with names on stdin" ' - test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)" +test_expect_success "hash two files with names on stdin" ' + test "$oids" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)" ' for args in "-w --stdin-paths" "--stdin-paths -w"; do push_repo - test_expect_success SHA1 "hash two files with names on stdin and write to database ($args)" ' - test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object $args)" + test_expect_success "hash two files with names on stdin and write to database ($args)" ' + test "$oids" = "$(echo_without_newline "$filenames" | git hash-object $args)" ' - test_blob_exists $hello_sha1 - test_blob_exists $example_sha1 + test_blob_exists "$(test_oid hello)" + test_blob_exists "$(test_oid example)" pop_repo done