Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Attributes "diff" and "filter" can not be used together. #303

Closed
Keepun opened this issue Jan 14, 2015 · 4 comments
Closed

Attributes "diff" and "filter" can not be used together. #303

Keepun opened this issue Jan 14, 2015 · 4 comments

Comments

@Keepun
Copy link

Keepun commented Jan 14, 2015

*.ext     diff=unicode filter=linetrim
[filter "linetrim"]
    clean = \"path/GitLineTrim.exe\"
[diff "unicode"]
    textconv = \"path/GitUnicode.exe\"

"filter" has a console input and output.

"diff" receives a temporary file and present the result of ignoring the "filter".

My GitTools

@dscho
Copy link
Member

dscho commented Jan 14, 2015

@Keepun this report is really confusing and unclear. Please rewrite it, paying attention to make it very easy to follow what you are getting at, and include a minimal example (avoiding the use of non-standard .exe files).

You should also test the behavior of Linux Git, via Vagrant, to ensure that the bug you are describing is really specific to Git for Windows (we cannot take care of bugs that are not limited to Windows).

@Keepun
Copy link
Author

Keepun commented Jan 14, 2015

Error in logic of execution of attributes.
I didn't check on the original version, but possibly a bug in it.

#!/bin/sh

unset GIT_DIR

mkdir gitfilter
cd gitfilter

echo '#!/usr/bin/perl' > testfilter.pl
echo 'while (my $line = <STDIN>) { print "$line + FILTER"; }' >> testfilter.pl

echo '#!/usr/bin/perl' > testdiff.pl
echo 'open(NFILE, "<", $ARGV[0]);' >> testdiff.pl
echo 'while (my $line = <NFILE>) { print "$line + DIFF"; }' >> testdiff.pl

git init
git config core.autocrlf input
echo -n 'some text' > file.tst
git add file.tst
git commit -m start

echo -n 'some text22 + FILTER + DIFF' > file.tst
git diff > res_diff_filter_mustbe

echo -n 'some text22' > file.tst
git diff > res_normal

git config filter.testfilter.clean testfilter.pl
git config diff.testdiff.textconv testdiff.pl

echo -e '*.tst\tfilter=testfilter' > .gitattributes
git diff > res_filter

echo -e '*.tst\tdiff=testdiff' > .gitattributes
git diff > res_diff

echo -e '*.tst\tdiff=testdiff filter=testfilter' > .gitattributes
git diff > res_diff_filter

echo 'Result:'
diff ./res_diff_filter ./res_diff_filter_mustbe

echo ''
echo 'Diff-script as Filter:'
git config filter.testdifffilter.clean testdifffilter.pl
echo '#!/usr/bin/perl' > testdifffilter.pl
echo 'while (my $line = <STDIN>) { print "$line + DIFF"; }' >> testdifffilter.pl

echo -e '*.tst\tfilter=testdifffilter filter=testfilter' > .gitattributes
git diff > res_difffilter_filter
echo -e '*.tst\tfilter=testfilter filter=testdifffilter' > .gitattributes
git diff > res_filter_difffilter

Result:

+some text22 + DIFF
vs.
+some text22 + FILTER + DIFF

And if some filters, result only from the last filter.

@Keepun
Copy link
Author

Keepun commented Jan 15, 2015

Yes, this bug is present in the original version of Git.

For testing for GNU/Linux it is necessary to add 'chmod +x *.pl'.

@dscho
Copy link
Member

dscho commented Jan 17, 2015

@Keepun thank you for investigating. As you probably know, the Git for Windows team is too small and underfunded to take care of Git issues that affect more than just Windows, therefore I would like to encourage you to report this issue with your findings to the Git mailing list: [email protected]. Thank you!

@dscho dscho closed this as completed Jan 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants