Re: qgit idea: interface for cherry-picking

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

 



"Marco Costalba" <mcostalba@xxxxxxxxx> 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@xxxxxxx>
---

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


-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]