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

[PATCH] revert: only suggest to commit if not passing -n

From
Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
Date
Jul 22, 2010, 13:51 UTC
Message-ID
<1279806692-6762-1-git-send-email-carenas@sajinet.com.pe>

while doing revert or cherry-pick, if the automatic merge fails and the user specifically suggested he didn't want to commit, then don't suggest to do that as part of the conflict resolution.

Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
---
 builtin/revert.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 8b9d829..72d0753 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -250,14 +250,18 @@ static char *help_msg(void)
 		return msg;
 
 	strbuf_addstr(&helpbuf, "  After resolving the conflicts,\n"
-		"mark the corrected paths with 'git add <paths>' or 'git rm <paths>'\n"
-		"and commit the result");
+		"mark the corrected paths with 'git add <paths>' or 'git rm <paths>'");
+	if (!no_commit) {
+		strbuf_addf(&helpbuf, "\nand commit the result");
 
-	if (action == CHERRY_PICK) {
-		strbuf_addf(&helpbuf, " with: \n"
-			"\n"
-			"        git commit -c %s\n",
-			    sha1_to_hex(commit->object.sha1));
+		if (action == CHERRY_PICK) {
+			strbuf_addf(&helpbuf, " with: \n"
+				"\n"
+				"        git commit -c %s\n",
+				    sha1_to_hex(commit->object.sha1));
+		}
+		else
+			strbuf_addch(&helpbuf, '.');
 	}
 	else
 		strbuf_addch(&helpbuf, '.');
-- 
1.7.1.1
Next: Jared Hance
Message 1 of 4 in “revert: only suggest to commit if not passing -n”
  1. revert: only suggest to commit if not passing -nCarlo Marcelo Arenas Belon, Jul 22, 2010
  2. Jared HanceJul 23, 2010
  3. revert: only suggest to commit if not passing -nCarlo Marcelo Arenas Belon, Jul 25, 2010
  4. Junio C HamanoAug 13, 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.