git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 4/8] revert: change help_msg() to take no argument

From
Christian Couder <chriscool@tuxfamily.org>
Date
Jun 2, 2010, 05:58 UTC
Message-ID
<20100602055842.21504.19150.chriscool@tuxfamily.org>
In-Reply-To
<20100602055131.21504.71923.chriscool@tuxfamily.org>

This is needed because the following commits will make it possible to cherry-pick many commits instead of just one.

So it will be possible to pass for example ranges of commits to "git cherry-pick" and this means that it will not be possible to use the arguments passed to "git cherry-pick" in the help message.

The help message will have to use the sha1 of the currently processed commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin/revert.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index c2aee86..aee1069 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -239,7 +239,7 @@ static void set_author_ident_env(const char *message)
 			sha1_to_hex(commit->object.sha1));
 }
 
-static char *help_msg(const char *name)
+static char *help_msg(void)
 {
 	struct strbuf helpbuf = STRBUF_INIT;
 	char *msg = getenv("GIT_CHERRY_PICK_HELP");
@@ -255,7 +255,7 @@ static char *help_msg(const char *name)
 		strbuf_addf(&helpbuf, " with: \n"
 			"\n"
 			"        git commit -c %s\n",
-			name);
+			    sha1_to_hex(commit->object.sha1));
 	}
 	else
 		strbuf_addch(&helpbuf, '.');
@@ -357,7 +357,7 @@ static void do_recursive_merge(struct commit *base, struct commit *next,
 		}
 		write_message(msgbuf, defmsg);
 		fprintf(stderr, "Automatic %s failed.%s\n",
-			me, help_msg(commit_name));
+			me, help_msg());
 		rerere(allow_rerere_auto);
 		exit(1);
 	}
@@ -484,7 +484,7 @@ static int do_pick_commit(void)
 		free_commit_list(remotes);
 		if (res) {
 			fprintf(stderr, "Automatic %s with strategy %s failed.%s\n",
-				me, strategy, help_msg(commit_name));
+				me, strategy, help_msg());
 			rerere(allow_rerere_auto);
 			exit(1);
 		}
-- 
1.7.1.362.g8d752
Previous: Christian CouderNext: Christian Couder
Message 5 of 9 in “implement cherry-picking many commits”
  1. 0/8 implement cherry-picking many commitsChristian Couder, Jun 2, 2010
  2. 1/8 revert: cleanup code for -x optionChristian Couder, Jun 2, 2010
  3. 2/8 revert: use run_command_v_opt() instead of execv_git_cmd()Christian Couder, Jun 2, 2010
  4. 3/8 revert: refactor code into a do_pick_commit() functionChristian Couder, Jun 2, 2010
  5. 4/8 revert: change help_msg() to take no argumentChristian Couder, Jun 2, 2010
  6. 5/8 revert: allow cherry-picking more than one commitChristian Couder, Jun 2, 2010
  7. 6/8 revert: add tests to check cherry-picking many commitsChristian Couder, Jun 2, 2010
  8. 7/8 Documentation/cherry-pick: describe passing more than one commitChristian Couder, Jun 2, 2010
  9. 8/8 Documentation/revert: describe passing more than one commitChristian Couder, Jun 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.