Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Potapov <dpotapov@gmail.com>2008-08-03 18:36:22 +0400
committerJunio C Hamano <gitster@pobox.com>2008-08-04 00:38:22 +0400
commit4a3d85dcf6722b7e5d16b5b1f69b51e39ad5f1dc (patch)
treec9aec5da0451797e6d6d03e9cb7bfed922c72734 /t/t1007-hash-object.sh
parent39702431500b76425f047209c9e9b2aae7e92b00 (diff)
add --no-filters option to git hash-object
The new option allows the contents to be hashed as is, ignoring any input filter that would have been chosen by the attributes mechanism. This option is incompatible with --path and --stdin-paths options. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1007-hash-object.sh')
-rwxr-xr-xt/t1007-hash-object.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index f3972a79af..fcdd15a358 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.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