Skip to contentSkip to conversation

enable userdiff for more things in git.git

PATCH In review Ævar Arnfjörð Bjarmason 2 participants 5 messages Apr 26, 2018

lore
Share & tools
lore
#0 lore raw

cover enable userdiff for more things in git.git

A noticed that git.git doesn't have userdiff enabled for perl files, and looking over some recent patches this gave better results, while I'm at it add one for Python too. I couldn't find anything in gitattributes(5) that was worth the bother of enabling this (e.g. we just have one Ruby file).

Ævar Arnfjörð Bjarmason (3):
.gitattributes: add *.pl extension for Perl
.gitattributes: use the "perl" differ for Perl
.gitattributes: add a diff driver for Python

 .gitattributes | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.0.290.gded63e768a
#1 lore raw

PATCH 1/3 .gitattributes: add *.pl extension for Perl

Change the list of Perl extensions added in 00ddc9d13c ("Fix build with core.autocrlf=true", 2017-05-09) to also include *.pl, we have some of those in the tree, e.g. in t/.

---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
.gitattributes +1 -0
index 8ce9c6b888..482af05a6a 100644
@@ -2,6 +2,7 @@
 *.[ch] whitespace=indent,trail,space diff=cpp
 *.sh whitespace=indent,trail,space eol=lf
 *.perl eol=lf
+*.pl eof=lf
 *.pm eol=lf
 /Documentation/git-*.txt eol=lf
 /command-list.txt eol=lf
Signature · 1 line
2.17.0.290.gded63e768a
#2 lore raw

PATCH 2/3 .gitattributes: use the "perl" differ for Perl

In reply to Ævar Arnfjörð Bjarmason

As noted in gitattributes(5) this gives better patch context for these types of files.

---
 .gitattributes | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
.gitattributes +3 -3
index 482af05a6a..aa08dd219d 100644
@@ -1,9 +1,9 @@
 * whitespace=!indent,trail,space
 *.[ch] whitespace=indent,trail,space diff=cpp
 *.sh whitespace=indent,trail,space eol=lf
-*.perl eol=lf
-*.pl eof=lf
-*.pm eol=lf
+*.perl eol=lf diff=perl
+*.pl eof=lf diff=perl
+*.pm eol=lf diff=perl
 /Documentation/git-*.txt eol=lf
 /command-list.txt eol=lf
 /GIT-VERSION-GEN eol=lf
Signature · 1 line
2.17.0.290.gded63e768a
#3 lore raw

PATCH 3/3 .gitattributes: add a diff driver for Python

In reply to Ævar Arnfjörð Bjarmason

Declare that the *.py files in our tree are Python for the purposes of diffing, and as in 00ddc9d13c ("Fix build with core.autocrlf=true", 2017-05-09) set eol=lf on them, which makes sense like with the *.perl files.

---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
.gitattributes +1 -0
index aa08dd219d..1bdc91e282 100644
@@ -4,6 +4,7 @@
 *.perl eol=lf diff=perl
 *.pl eof=lf diff=perl
 *.pm eol=lf diff=perl
+*.py eol=lf diff=python
 /Documentation/git-*.txt eol=lf
 /command-list.txt eol=lf
 /GIT-VERSION-GEN eol=lf
Signature · 1 line
2.17.0.290.gded63e768a
#4 lore raw
In reply to Ævar Arnfjörð Bjarmason
Quoted 10 lines · Ævar Arnfjörð Bjarmason

A noticed that git.git doesn't have userdiff enabled for perl files, and looking over some recent patches this gave better results, while I'm at it add one for Python too. I couldn't find anything in gitattributes(5) that was worth the bother of enabling this (e.g. we just have one Ruby file).

Ævar Arnfjörð Bjarmason (3):
.gitattributes: add *.pl extension for Perl
.gitattributes: use the "perl" differ for Perl
.gitattributes: add a diff driver for Python

All looked sane, except one minor "Huh?" in the titles.

The last one in the above list makes it look as if you are adding the func header pattern and/or textconv filter for Python source code, but the patch actually just specifies that .py is to be processed by the existing diff driver meant for Python, and at least to me, the wording for the second one reflects that better.