From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>, git@vger.kernel.org
Subject: Re: [PATCH v2 1/2] Allow git-apply to ignore the hunk headers
Date: Thu, 5 Jun 2008 23:39:48 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.1.00.0806052304300.21190@racer> (raw)
In-Reply-To: <7vabhz1t2f.fsf@gitster.siamese.dyndns.org>
Hi,
On Thu, 5 Jun 2008, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Sometimes, the easiest way to fix up a patch is to edit it directly,
> > even adding or deleting lines. Now, many people are not as divine as
> > certain benevolent dictators as to update the hunk headers correctly
> > at the first try.
> >
> > So teach the tool to do it for us.
>
> Two comments and a half.
>
> * Latest POSIX draft talks about unified context and allows an empty line
> to represent an empty common context line. GNU diff already emits such
> a diff. fixup_counts() should take this into account.
As you pointed out, I wanted to support only add -e. But that should not
be an issue at all. I think a "case ' ': case '\n':" should be enough,
right?
> * I'd sleep better at night if 'Probably "diff ..."' part were written
> in a bit more robust way.
How about stopping on "@@" and end of file only, and complaining
otherwise?
> * (minor) There is an established term for this operation: recountdiff,
> so --recount might be a better name. fixup_counts() also is better
> called recount_diff() if we go this route.
Fine!
> If you are too narrowly focused to only support "git add -e", the first
> issue does not matter, because we always emit "SP LF" for such a common
> context. The reason why I care about the first two points is because we
> may want to teach git-am about this new option as well in 1.6.0.
Point taken.
> And the robustness issue I worry about the second point also applies to
> a line that is "^-- $", especially if we were to make this available to
> git-am. Perhaps when the line begins with a '-', the logic could be
> extra careful to detect the case where the line looks like the e-mail
> signature separator and check one line beyond it to see if it does not
> look anything like part of a diff (in which case you stop, without
> considering the line you are currently looking at, "^-- $", a deletion
> of "^- $", as part of the preimage context).
Is this really an issue? fixup_counts() is only called after a hunk
header was read, and that should be well after any "^-- $".
> As to code structure, we might want to make the later parameters to
> apply_patch() an integer, of OR'ed flag values, or even a pointer to a
> structure that holds options.
Right.
Will fix up and resubmit.
Ciao,
Dscho
next prev parent reply other threads:[~2008-06-05 22:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-05 10:16 [PATCH 1/2] Allow git-apply to fix up the line counts Johannes Schindelin
2008-06-05 10:17 ` [PATCH 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-05 11:24 ` [PATCH 1/2] Allow git-apply to fix up the line counts Johannes Sixt
2008-06-05 13:04 ` Johannes Schindelin
2008-06-05 13:36 ` Johannes Sixt
2008-06-05 13:47 ` Johannes Schindelin
2008-06-05 14:13 ` Johannes Sixt
2008-06-05 14:54 ` Johannes Schindelin
2008-06-05 15:07 ` Johannes Sixt
2008-06-05 16:19 ` [PATCH v2 0/2] git add --edit Johannes Schindelin
2008-06-05 16:20 ` [PATCH v2 1/2] Allow git-apply to ignore the hunk headers Johannes Schindelin
2008-06-05 21:16 ` Junio C Hamano
2008-06-05 22:39 ` Johannes Schindelin [this message]
2008-06-05 23:06 ` [PATCH v3 0/2] git add --edit Johannes Schindelin
2008-06-05 23:06 ` [PATCH v3 1/2] Allow git-apply to ignore the hunk headers (AKA recountdiff) Johannes Schindelin
2008-06-06 4:55 ` Junio C Hamano
2008-06-06 13:58 ` Johannes Schindelin
2008-06-06 15:34 ` Junio C Hamano
2008-06-06 16:13 ` Junio C Hamano
2008-06-06 16:37 ` Johannes Schindelin
2008-06-06 16:46 ` Junio C Hamano
2008-06-06 17:35 ` Johannes Schindelin
2008-06-06 5:18 ` Govind Salinas
2008-06-06 14:00 ` Johannes Schindelin
2008-06-05 23:07 ` [PATCH v3 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-06 10:02 ` Olivier Marin
2008-06-06 14:21 ` Johannes Schindelin
2008-06-06 4:55 ` [PATCH v3 0/2] git add --edit Junio C Hamano
2008-06-06 13:59 ` Johannes Schindelin
2008-06-05 23:22 ` [PATCH v2 1/2] Allow git-apply to ignore the hunk headers Junio C Hamano
2008-06-05 23:36 ` Johannes Schindelin
2008-06-06 7:02 ` Paolo Bonzini
2008-06-06 14:04 ` Johannes Schindelin
2008-06-06 10:33 ` Sergei Organov
2008-06-06 14:27 ` Johannes Schindelin
2008-06-06 15:14 ` Junio C Hamano
2008-06-05 16:20 ` [PATCH v2 2/2] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2008-06-05 18:12 ` Pieter de Bie
2008-06-05 18:39 ` [PATCH 1/2] Allow git-apply to fix up the line counts Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.00.0806052304300.21190@racer \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).