Code

Merge branch 'maint'
[git.git] / t / t1007-hash-object.sh
index f3972a79afe515fb02b3d984c5185e0a723aab1b..fd98e445bf2e74284709df54d2cd2d3f0006b19c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description="git-hash-object"
+test_description="git hash-object"
 
 . ./test-lib.sh
 
@@ -65,6 +65,14 @@ test_expect_success "Can't use --path with --stdin-paths" '
        echo example | test_must_fail git hash-object --stdin-paths --path=foo
 '
 
+test_expect_success "Can't use --stdin-paths with --no-filters" '
+       echo example | test_must_fail git hash-object --stdin-paths --no-filters
+'
+
+test_expect_success "Can't use --path with --no-filters" '
+       test_must_fail git hash-object --no-filters --path=foo
+'
+
 # Behavior
 
 push_repo
@@ -117,6 +125,22 @@ test_expect_success 'check that appropriate filter is invoke when --path is used
        git config --unset core.autocrlf
 '
 
+test_expect_success 'check that --no-filters option works' '
+       echo fooQ | tr Q "\\015" >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" &&
+       nofilters_file1=$(git hash-object --no-filters file1) &&
+       test "$file0_sha" = "$nofilters_file1" &&
+       nofilters_file1=$(cat file1 | git hash-object --stdin) &&
+       test "$file0_sha" = "$nofilters_file1" &&
+       git config --unset core.autocrlf
+'
+
 pop_repo
 
 for args in "-w --stdin" "--stdin -w"; do