git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Robert Dailey <rcdailey.lists@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: Patch add: previous hunk across file boundaries
Date: Fri, 11 May 2018 13:47:56 -0400	[thread overview]
Message-ID: <20180511174756.GB19670@sigill.intra.peff.net> (raw)
In-Reply-To: <CAHd499CKJTnjvPSMqoFZDWw-6PYX4_AxLr0yC6CaMi7VO9TBzQ@mail.gmail.com>

On Fri, May 11, 2018 at 09:53:52AM -0500, Robert Dailey wrote:

> I noticed that when stepping into a new file while doing `git add -p`,
> pressing `k` or `K` does not go back to the previous file. Is this a
> bug? Is there a setting for it? I googled & checked out the git docs,
> I didn't find any specific information on this.

Nope, this is just the way that "-p" is implemented. It considers each
file independently (another artifact of this is that after completing
the hunks in a file the changes are staged, even if you quit while
looking at a hunk in another file).

I agree that it would be nicer to consider the whole set atomically,
with both "save and quit" and "quit but do not save" options. The way it
works now is mostly due to the way that "add -p" grew out of the whole
"add -i" interactive system, where you'd invoke the patch-adder on
specific files from a menu.

So no, there's not a way to do what you want right now short of writing
patch.

-Peff

      reply	other threads:[~2018-05-11 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 14:53 Patch add: previous hunk across file boundaries Robert Dailey
2018-05-11 17:47 ` 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=20180511174756.GB19670@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=rcdailey.lists@gmail.com \
    /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).