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

committed by
Junio C Hamano

parent
3970243150
commit
4a3d85dcf6
@ -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
|
||||
|
Reference in New Issue
Block a user