git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "Marco Costalba" <mcostalba@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: qgit idea: interface for cherry-picking
Date: Sun, 02 Jul 2006 23:42:22 -0700	[thread overview]
Message-ID: <7vzmfrrxyp.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <e5bfff550607022245s2ef160fu5ad30a822f06117d@mail.gmail.com> (Marco Costalba's message of "Mon, 3 Jul 2006 07:45:17 +0200")

"Marco Costalba" <mcostalba@gmail.com> writes:

> When I need to modify the patch/revision before to import I usaually
> drag&drop and then I call git-reset --soft, then I edit working
> directory and commit again.

These days, I tend to just let "am" or "pull" do its thing, edit
working tree and retest, and run "commit --amend".  Before we
added "commit --amend", I used to do soft reset and recommit
like you described above.  One advantage of "commit --amend" is
that it can even amend a merge, but I do not think it applies to
what Jakub wants in this thread.

> Perhaps I can automate this in case the user answers "No, apply to
> working dir only" to the message box.
>
> Is it the correct way to go or is better to wait for a --no-commit
> flag in git-am?

Probably your "git-am --no-commit" would stop after applying one
patch (the first one in the sequence) but before writing a
commit.  We already sometimes do that when the patch does not
apply cleanly, so I do not offhand have much objection against
adding such a flag.

I think the workflow to continue after "git-am --no-commit" will
be quite similar to what you would do when "git-am --3way" stops
with conflicts.  In order to continue from there, you would do
whatever is needed to bring the index into the shape you wanted
to have if the patch applied cleanly.  Then "git am --resolved".

Perhaps something like the attached.  If somebody finds it
useful, after testing it out, please kick it back to me, perhaps
with a paragraph or two to properly document it.

-- >8 --
git-am --fail

The new flag prevents a new commit from being made even when the
patch applies cleanly.  This gives you an opportunity to further
fix up the change in your working tree before making the final
commit.

In order to continue, do whatever is needed to bring the index
into the shape you wanted to have if the patch applied cleanly,
and run "git am --resolved".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

diff --git a/git-am.sh b/git-am.sh
index 679045a..77d8cd9 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -3,7 +3,7 @@ #
 # Copyright (c) 2005, 2006 Junio C Hamano
 
 USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way]
-  [--interactive] [--whitespace=<option>] <mbox>...
+  [--fail] [--interactive] [--whitespace=<option>] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
 
@@ -91,7 +91,7 @@ fall_back_3way () {
 }
 
 prec=4
-dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg=
+dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg= fail=
 
 while case "$#" in 0) break;; esac
 do
@@ -109,6 +109,9 @@ do
 	-b|--b|--bi|--bin|--bina|--binar|--binary)
 	binary=t; shift ;;
 
+	-f|--f|--fa|--fai|--fail)
+	fail=t; shift ;;
+
 	-3|--3|--3w|--3wa|--3way)
 	threeway=t; shift ;;
 	-s|--s|--si|--sig|--sign|--signo|--signof|--signoff)
@@ -401,6 +404,10 @@ do
 	then
 		echo Patch failed at $msgnum.
 		stop_here_user_resolve $this
+	elif test -n "$fail"
+	then
+		echo Stopped at $msg per user request
+		stop_here_user_resolve $this
 	fi
 
 	if test -x "$GIT_DIR"/hooks/pre-applypatch

  reply	other threads:[~2006-07-03  6:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-02 19:01 qgit idea: interface for cherry-picking Jakub Narebski
2006-07-02 21:33 ` Marco Costalba
2006-07-02 21:46   ` Jakub Narebski
2006-07-02 22:04     ` Marco Costalba
2006-07-02 22:54       ` Jakub Narebski
2006-07-03  5:45         ` Marco Costalba
2006-07-03  6:42           ` Junio C Hamano [this message]
2006-07-03 11:18             ` Marco Costalba
2006-07-03 20:03               ` Junio C Hamano
2006-07-04  6:22                 ` Marco Costalba
2006-07-04  6:39                   ` Jakub Narebski
2006-07-04 11:58                     ` Marco Costalba
2006-07-04 13:29                       ` Jakub Narebski
2006-07-04 18:38                         ` Marco Costalba
2006-07-04  6:41                   ` Junio C Hamano
2006-07-04  7:02                     ` Jakub Narebski
2006-07-04 11:21                     ` Marco Costalba
2006-07-04 18:23                       ` Marco Costalba

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=7vzmfrrxyp.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=mcostalba@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).