Re: [PATCH] Add diff directives to gitattributes

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [PATCH] Add diff directives to gitattributes
Дата
Msg-id CAB7nPqRtXmEavVpyY1n+kkfWF=P2vkwfVobpRghRU83Cs37DXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add diff directives to gitattributes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Nov 30, 2016 at 5:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
>> Attached is a patch which adds diff= directives to .gitattributes for C,
>> Perl and (X|SG)ML files.  This makes word diffs and the function
>> indicator in the diff chunk header and more useful.
>
> Could you provide some examples of what that actually does to the output?

Per the git documentation [1], this is aimed at making the hunk
headers in a diff output more readable. For example, take this dummy
patch on a perl file:
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl
index 1764b17..729bc6d 100644
--- a/src/bin/pg_rewind/t/001_basic.pl
+++ b/src/bin/pg_rewind/t/001_basic.pl
@@ -5,6 +5,13 @@ use Test::More tests => 8;
use RewindTest;

+sub run_test2
+{
+       my $test_mode = shift;
+
+       master_sql();
+}
+sub run_test{       my $test_mode = shift;

The point to focus on is that, which is what you get on HEAD:
@@ -5,6 +5,13 @@ use Test::More tests => 8;
But what you get with this patch is that:
@@ -5,6 +5,13 @@
So this makes the detection of a subroutine being changed by a diff
more intelligent.

With or without this patch, for example I patch a subroutine I am
still getting that for both cases:
@@ -30,6 +37,10 @@ sub run_test

And as far as I can read from the docs, it is perfectly possible to
set up that at a global level with a dedicated section like [diff
"perl"]. And in short, this is a change to decide if we decide to
still rely on GNU diff -p or on what git decides is good. Honestly I
am -1 to enforce that to everybody doing serious hacking.

[1]: https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Okano, Naoki"
Дата:
Сообщение: Re: pg_recvlogical --endpos
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: pg_recvlogical --endpos