unified vs context diffs (was Re: Strange Windows problem, lock_timeout test request) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject unified vs context diffs (was Re: Strange Windows problem, lock_timeout test request)
Date
Msg-id 5129D306.5010804@vmware.com
Whole thread Raw
In response to Re: Strange Windows problem, lock_timeout test request  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: unified vs context diffs (was Re: Strange Windows problem, lock_timeout test request)  (Stephen Frost <sfrost@snowman.net>)
Re: unified vs context diffs (was Re: Strange Windows problem, lock_timeout test request)  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List pgsql-hackers
On 24.02.2013 05:07, Andrew Dunstan wrote:
> On 02/23/2013 01:15 PM, Boszormenyi Zoltan wrote:
>>>
>>> First off, it's not in context diff format, which is the PG standard for
>>> patch submission.
>>
>> Since moving to GIT, this expectation is obsolete. All PG hackers
>> became comfortable with the unified diff format, see references
>> from the list. A lot of hackers post "git diff" patches which cannot
>> produce context diff, either.
>
> I am not aware that project policy has changed in the slightest in this
> regard.

I can't speak for others, but I personally don't care whether a patch is 
posted in unified or context diff format. Not as a general rule, anyway; 
patches that modify a few lines here and there are generally more 
readable in unified format, as the old and new lines are lined up right 
next to each other:

@@ -329,7 +346,7 @@ foreign_expr_walker(Node *node, foreign_expr_cxt 
*context) static bool is_builtin(Oid oid) {
-       return (oid < FirstNormalObjectId);
+       return (oid < FirstBootstrapObjectId); }

Then again, more complicated patches that modify large chunks of code 
are often unreadable when the - and + lines are mixed up in the same 
chunk; those are more readable in context format.

So if you want to be kind to readers, look at the patch and choose the 
format depending on which one makes it look better. But there's no need 
to make a point of it when someone posts in "wrong" format.

> Every unified diff can be turned into a context diff by passing it
> though "filterdiff --format=context".

Yep. And in emacs, there's "diff-unified->context" command. I bet most 
editors have a similar functionality these days.

- Heikki



pgsql-hackers by date:

Previous
From: Boszormenyi Zoltan
Date:
Subject: Re: Strange Windows problem, lock_timeout test request
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: Strange Windows problem, lock_timeout test request