threads / patch / 48362

patch, 3 partsenable userdiff for more things in git.git

Subject: [PATCH 0/3] enable userdiff for more things in git.git

## tl;dr

5 messages between Apr 26, 2018 and Apr 26, 2018. Diffs are folded; open one to read it.

replies: 4people: 2as markdown or json

Ævar Arnfjörð Bjarmason· Apr 26, 2018, 07:50 UTC · lore

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(-)
-- 
2.17.0.290.gded63e768a
Ævar Arnfjörð Bjarmason· Apr 26, 2018, 07:50 UTC · re: Ævar Arnfjörð Bjarmason · lore

[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/.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
Show changes to .gitattributes +1 −0
diff --git a/.gitattributes b/.gitattributes
index 8ce9c6b888..482af05a6a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
-- 
2.17.0.290.gded63e768a
Ævar Arnfjörð Bjarmason· Apr 26, 2018, 07:50 UTC · re: Ævar Arnfjörð Bjarmason · lore

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

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

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 .gitattributes | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Show changes to .gitattributes +3 −3
diff --git a/.gitattributes b/.gitattributes
index 482af05a6a..aa08dd219d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
-- 
2.17.0.290.gded63e768a
Ævar Arnfjörð Bjarmason· Apr 26, 2018, 07:50 UTC · re: Ævar Arnfjörð Bjarmason · lore

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

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.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
Show changes to .gitattributes +1 −0
diff --git a/.gitattributes b/.gitattributes
index aa08dd219d..1bdc91e282 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
-- 
2.17.0.290.gded63e768a
Junio C Hamano· Apr 26, 2018, 09:43 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 0/3] enable userdiff for more things in git.git

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 10 quoted lines
> 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.

← back to recent threads