aboutsummaryrefslogtreecommitdiff
path: root/t/t2003-checkout-cache-mkdir.sh
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-03-14 20:00:51 +0000
committerJunio C Hamano <gitster@pobox.com>2013-03-14 14:49:48 -0700
commit7297a440122b329c501e70dda099030373af069f (patch)
tree21a99bbcae115520fb4dacf2b3bcde0cce187c1e /t/t2003-checkout-cache-mkdir.sh
parent013c3bb81ee1643ce69a64197b2075212492c352 (diff)
downloadgit-7297a440122b329c501e70dda099030373af069f.tar.gz
git-7297a440122b329c501e70dda099030373af069f.tar.xz
entry: fix filter lookup
When looking up the stream filter, write_entry() should be passing the path of the file in the repository, not the path to which the content is going to be written. This allows the file to be correctly looked up against the .gitattributes files in the working tree. This change makes the streaming case match the non-streaming case which passes ce->name to convert_to_working_tree later in the same function. The two tests added here test the different paths through write_entry since the CRLF filter is a streaming filter but the user-defined smudge filter is not streamed. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2003-checkout-cache-mkdir.sh')
-rwxr-xr-xt/t2003-checkout-cache-mkdir.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
index 63fd0a883..4c97468b8 100755
--- a/t/t2003-checkout-cache-mkdir.sh
+++ b/t/t2003-checkout-cache-mkdir.sh
@@ -90,4 +90,30 @@ test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '
test -f tmp-path1/file1
'
+test_expect_success 'apply filter from working tree .gitattributes with --prefix' '
+ rm -fr path0 path1 path2 tmp* &&
+ mkdir path1 &&
+ mkdir tmp &&
+ git config filter.replace-all.smudge "sed -e s/./=/g" &&
+ git config filter.replace-all.clean cat &&
+ git config filter.replace-all.required true &&
+ echo "file1 filter=replace-all" >path1/.gitattributes &&
+ git checkout-index --prefix=tmp/ -f -a &&
+ echo frotz >expected &&
+ test_cmp expected tmp/path0 &&
+ echo ====== >expected &&
+ test_cmp expected tmp/path1/file1
+'
+
+test_expect_success 'apply CRLF filter from working tree .gitattributes with --prefix' '
+ rm -fr path0 path1 path2 tmp* &&
+ mkdir path1 &&
+ mkdir tmp &&
+ echo "file1 eol=crlf" >path1/.gitattributes &&
+ git checkout-index --prefix=tmp/ -f -a &&
+ echo rezrovQ >expected &&
+ tr \\015 Q <tmp/path1/file1 >actual &&
+ test_cmp expected actual
+'
+
test_done