Re: Run pgindent now?

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Run pgindent now?
Дата
Msg-id CA+Tgmobb-65pakz-+=pmC7FZG9NwGkHKd4DANhyR2U1cQzhCWA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Run pgindent now?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, May 26, 2015 at 3:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Realistically, with merge.conflictstyle = diff3 (why is this not the
>> default?), resolving whitespace conflicts that occur when you try to
>> cherry-pick is typically not very difficult.
>
> Really?  The problems I have generally come from places where pgindent
> has changed the line breaks, not just horizontal spacing.  I haven't
> seen anything that copes with this, certainly not git.

Well, it's not fully automated, but if you set the setting above, and
then cherry-pick, your merge conflicts will look something like this:

<<<<<<<
side A
|||||||
original version
=======
side B
>>>>>>>

Either side A or side B will be what changed in the patch you
cherry-picked, and the other will be what changed in the branch in the
meantime.  I forget which is which.  So you notice that one of the two
sides differs from the original version only in terms of whitespace
and delete that side, keeping the other side.  Done.

In general, the way you resolve these conflicts is by choosing the
side that has fewer changes from the original version, noting how it
differs from the original version, modifying the other side
accordingly, and then deleting the other two versions.  For example:

<<<<<<<
here we renamed the function!
|||||||
original version
=======
here we added an additional parameter to the function call!
>>>>>>>

So you either change side B to the new function name and remove side
A, or else you change side A to pass the extra parameter and remove
side B.  In either case you remove the original version.

This is obviously not zero effort.  At the same time, it's not much
effort, either.  I resolve these kinds of mechanical conflicts all the
time, and they don't take up much time or effort.  If you have to deal
with this kind of crap using "patch", it bites.  If you use git but
with the default conflictstyle, you don't get the "original version"
part of the conflict, so it still bites.  But after a modest amount of
practice, resolving trivial conflicts with merge.conflictstyle=diff3
is pretty darn easy.  Or at least, I have found it so.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: psql po translation update
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Construction of Plan-node by CSP (RE: Custom/Foreign-Join-APIs)