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

5 messages from 2018-04-26 to 2018-04-26. Participants: Ævar Arnfjörð Bjarmason, Junio C Hamano.
Thread: https://gitlist.dev/t/48362

## Ævar Arnfjörð Bjarmason, 2018-04-26 07:50

Subject: [PATCH 0/3] enable userdiff for more things in git.git
Message-ID: <20180426075058.9322-1-avarab@gmail.com>
URL: https://gitlist.dev/e/20180426075058.9322-1-avarab%40gmail.com

```
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, 2018-04-26 07:50

Subject: [PATCH 1/3] .gitattributes: add *.pl extension for Perl
Message-ID: <20180426075058.9322-2-avarab@gmail.com>
URL: https://gitlist.dev/e/20180426075058.9322-2-avarab%40gmail.com
In-Reply-To: <20180426075058.9322-1-avarab@gmail.com>

```
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(+)

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, 2018-04-26 07:50

Subject: [PATCH 2/3] .gitattributes: use the "perl" differ for Perl
Message-ID: <20180426075058.9322-3-avarab@gmail.com>
URL: https://gitlist.dev/e/20180426075058.9322-3-avarab%40gmail.com
In-Reply-To: <20180426075058.9322-1-avarab@gmail.com>

```
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(-)

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, 2018-04-26 07:50

Subject: [PATCH 3/3] .gitattributes: add a diff driver for Python
Message-ID: <20180426075058.9322-4-avarab@gmail.com>
URL: https://gitlist.dev/e/20180426075058.9322-4-avarab%40gmail.com
In-Reply-To: <20180426075058.9322-1-avarab@gmail.com>

```
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(+)

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, 2018-04-26 09:43

Subject: Re: [PATCH 0/3] enable userdiff for more things in git.git
Message-ID: <xmqqr2n21ex1.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqr2n21ex1.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20180426075058.9322-1-avarab@gmail.com>

```
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

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


```
