[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change "patch" to output unified-diff rejects

From: Wayne Davison
Subject: Re: Change "patch" to output unified-diff rejects
Date: Thu, 29 Jan 2004 19:43:41 -0800
User-agent: Mutt/

On Thu, Jan 29, 2004 at 04:38:58PM -0800, Paul Eggert wrote:
> POSIX requires that the output be in context diff format.  However,
> the POSIX requirement does not apply if the input is in unified
> format, so it'd be OK to for 'patch' to output .rej as unified format
> if the input patch was unified.

OK, that's easy enough to do.  Patch is attached.  I chose to create two
separate functions for clarity and small patch size.  (I looked briefly
at the idea of using the same code to output both styles, and didn't
like how complex the "if unified" checks would have made things.)

> In this case perhaps the best thing to do is to output the malformed
> hunk as-is (as much as possible), much as the previous abort_hunk()
> did.

I looked at this a bit more, and I don't believe these lines can occur
with a unified context diff.  The code will put a '\n' item prior to the
"new" section of the hunk if there is an empty line between the end of
the "***" section and the start of the "---" section of a context-diff
hunk.  However, for completeness sake, I went ahead and output any '\n'
items it finds before the '=' item in the data.


Attachment: unified-reject.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]