git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: phillip.wood@dunelm.org.uk
Cc: Marcel Partap <mpartap@gmx.net>, git@vger.kernel.org
Subject: Re: [PATCH] add -p: obey diff.noprefix option if set
Date: Mon, 6 Mar 2023 05:31:02 -0500	[thread overview]
Message-ID: <ZAXA5ikipcTCfptl@coredump.intra.peff.net> (raw)
In-Reply-To: <0ba2f495-892c-3e27-a32c-9f136e86fc26@dunelm.org.uk>

On Mon, Mar 06, 2023 at 09:39:07AM +0000, Phillip Wood wrote:

> > The second is to just remember that we set noprefix and to add the
> > matching "-p0". Unfortunately we have to do so in a few places, but it's
> > not _too_ bad (and possibly some refactoring could make it less ugly).
> > Something like:
> 
> I think that is the better approach. Looking at how we handle diff.algorithm
> we should maybe add a "noprefix" member to "struct add_i_state" and
> initialize it in init_add_i_state() (which is in add-interactive.c). That
> way we're consistent with the existing code and we don't need to keep
> calling git_config_get_bool() whenever we want the value of diff.noPrefix.

Yeah, that was exactly the kind of refactoring I had in mind (but I
didn't work on it, even as a "maybe something like this" patch).

I agree it's the better approach.

> >   	strvec_pushv(&cp.args, s->mode->apply_check_args);
> > +	if (!git_config_get_bool("diff.noprefix", &noprefix) && noprefix)
> > +		strvec_pushf(&cp.args, "-p1");
> 
> I think you meant "-p0" here

Whoops, yes.

-Peff

      reply	other threads:[~2023-03-06 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 12:39 [PATCH] add -p: obey diff.noprefix option if set Marcel Partap
2023-03-06  8:40 ` Jeff King
2023-03-06  9:39   ` Phillip Wood
2023-03-06 10:31     ` Jeff King [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAXA5ikipcTCfptl@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mpartap@gmx.net \
    --cc=phillip.wood@dunelm.org.uk \
    /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.
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 NNTP newsgroup(s).