login
Header Space

 
 

Re: Rebase/cherry-picking idea

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Wincent Colaiuta <win@...>
Cc: Johannes Schindelin <Johannes.Schindelin@...>, Johannes Sixt <j.sixt@...>, Benoit Sigoure <tsuna@...>, Git Mailing List <git@...>
Date: Wednesday, November 28, 2007 - 4:06 am

> Once I get a clear idea of what kind of change is likely to actually  

Too often, people disappear with a patch that is basically good but has
room for improvements this way.  I really do not have time nor bandwidth
to keep bugging them for updates, and often end up cleaning up on my own
instead.

This is such a patch, and without acks or comments, it is also very
likely to be lost.

-- >8 --
revert/cherry-pick: Allow overriding the help text by the calling Porcelain

A Porcelain command that uses cherry-pick or revert may make a commit
out of resolved index itself, in which case telling the user to commit
the result is not appropriate at all.  This allows GIT_CHERRY_PICK_HELP
environment variable to be set by the calling Porcelain in order to
override the built-in help text.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * I suspect that "git rebase --continue" can do "git add -u" itself,
   just like recent "git rebase --skip" would do "git reset --hard".

   The overriding help text in this patch can lose its second line that
   tells the user to use "git add <paths>" if we decide to do so.

 builtin-revert.c           |   33 +++++++++++++++++++++++----------
 git-rebase--interactive.sh |    5 +++++
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/builtin-revert.c b/builtin-revert.c
index a0586f9..4f86178 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -224,6 +224,27 @@ static int merge_recursive(const char *base_sha1,
 	return run_command_v_opt(argv, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD);
 }
 
+static char *help_msg(const unsigned char *sha1)
+{
+	static char helpbuf[1024];
+	char *msg = getenv("GIT_CHERRY_PICK_HELP");
+
+	if (msg)
+		return msg;
+
+	strcpy(helpbuf, "  After resolving the conflicts,\n"
+	       "mark the corrected paths with 'git add <paths>' "
+	       "and commit the result.");
+
+	if (action == CHERRY_PICK) {
+		sprintf(helpbuf + strlen(helpbuf),
+			"\nWhen commiting, use the option "
+			"'-c %s' to retain authorship and message.",
+			find_unique_abbrev(sha1, DEFAULT_ABBREV));
+	}
+	return helpbuf;
+}
+
 static int revert_or_cherry_pick(int argc, const char **argv)
 {
 	unsigned char head[20];
@@ -352,16 +373,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 		}
 		if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
 			die ("Error wrapping up %s", defmsg);
-		fprintf(stderr, "Automatic %s failed.  "
-			"After resolving the conflicts,\n"
-			"mark the corrected paths with 'git add <paths>' "
-			"and commit the result.\n", me);
-		if (action == CHERRY_PICK) {
-			fprintf(stderr, "When commiting, use the option "
-				"'-c %s' to retain authorship and message.\n",
-				find_unique_abbrev(commit->object.sha1,
-					DEFAULT_ABBREV));
-		}
+		fprintf(stderr, "Automatic %s failed.%s\n",
+			me, help_msg(commit->object.sha1));
 		exit(1);
 	}
 	if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bf44b6a..33a5d4b 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -30,6 +30,11 @@ test -d "$REWRITTEN" && PRESERVE_MERGES=t
 test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
 test -f "$DOTEST"/verbose && VERBOSE=t
 
+GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
+mark the corrected paths with 'git add <paths>', and
+run 'git rebase --continue'"
+export GIT_CHERRY_PICK_HELP
+
 warn () {
 	echo "$*" >&2
 }
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 5:02 am)
Re: Rebase/cherry-picking idea, Benoit Sigoure, (Mon Nov 26, 5:32 am)
Re: Rebase/cherry-picking idea, Johannes Schindelin, (Mon Nov 26, 9:26 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 7:27 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 8:34 am)
Re: Rebase/cherry-picking idea, Johannes Sixt, (Mon Nov 26, 8:51 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Mon Nov 26, 1:26 pm)
Re: Rebase/cherry-picking idea, Shawn O. Pearce, (Mon Nov 26, 9:08 pm)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Mon Nov 26, 9:25 pm)
Re: Rebase/cherry-picking idea, Marco Costalba, (Mon Nov 26, 3:12 pm)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 9:15 am)
Re: Rebase/cherry-picking idea, Johannes Schindelin, (Mon Nov 26, 9:41 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 9:55 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 4:06 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Wed Nov 28, 4:52 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 5:47 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Wed Nov 28, 6:04 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 2:44 pm)
[PATCH] Replace instances of export VAR=VAL with VAR=VAL; ex..., Johannes Schindelin, (Wed Nov 28, 9:57 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:29 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 3:03 pm)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 7:08 pm)
[PATCH v2] Replace instances of export VAR=VAL with VAR=VAL;..., Johannes Schindelin, (Wed Nov 28, 11:56 am)
Re: [PATCH v2] Replace instances of export VAR=VAL with VAR=..., Johannes Schindelin, (Wed Nov 28, 7:05 pm)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Nguyen Thai Ngoc Duy, (Wed Nov 28, 10:19 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:27 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Nguyen Thai Ngoc Duy, (Wed Nov 28, 10:27 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:36 am)
Re: Rebase/cherry-picking idea, Benoit Sigoure, (Mon Nov 26, 8:39 am)
speck-geostationary