Closed Keepun closed 9 years ago
@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).
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.
Yes, this bug is present in the original version of Git.
For testing for GNU/Linux it is necessary to add 'chmod +x *.pl'.
@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: git@vger.kernel.org. Thank you!
"filter" has a console input and output.
"diff" receives a temporary file and present the result of ignoring the "filter".
My GitTools