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

Re: Regulator updates for 3.3

From
PGPaul Gortmaker <paul.gortmaker@windriver.com>
Date
Jan 11, 2012, 18:40 UTC
Message-ID
<20120111184026.GA23952@windriver.com>
In-Reply-To
<CA+55aFxvQF=Bm4ae6euB_UO8otMCuN9Lv37Zn3TpE-L7JH3Kzw@mail.gmail.com>
[Re: Regulator updates for 3.3] On 10/01/2012 (Tue 14:54) Linus Torvalds wrote:
[...]
> So right now "git merge" (and "git pull") make it too easy to make
> those meaningless merge commits. If instead of seven pointless merges

It looks like the editor-by-default solution is a go, but there still might be value in increasing the visibility of the pointless merges via. the patch below.

Paul.
Show 8 quoted lines
> you had (say) had two merges that had messages about *why* they
> weren't pointless, I'd be perfectly happy.
> 
> Addid junio and git to the cc just to bring up this issue of bad UI
> once again. I realize it could break old scripts to start up an editor
> window, but still..
> 
>                        Linus
>From 1a548fa97b78cebcded15d2b00ee3d826f731abd Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Wed, 11 Jan 2012 10:33:45 -0500
Subject: [PATCH] merge: Make merge strategy message follow the diffstat

One of the common problems I've seen with people who are somewhat new to git is that they don't realize that a pull is a fetch+merge. They simply decide they want all the latest stuff and issue a git pull without really thinking if they are on a branch with local commits or on master, where a fast forward can take place.

But the one line message that tells you whether you got a fast forward or a real merge commit is usually pushed off the screen by all the diffstat information. So these users won't even know that their pull has created a merge, and chances are they will never change their workflow.

By moving the message after the diffstat, there is a better chance that people will be aware they've done a pointless merge commit.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/builtin/merge.c b/builtin/merge.c
index 3a45172..9471588 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -370,12 +370,12 @@ static void finish(struct commit *head_commit,
 {
 	struct strbuf reflog_message = STRBUF_INIT;
 	const unsigned char *head = head_commit->object.sha1;
+	int automsg = 0;
 
-	if (!msg)
+	if (!msg) {
+		automsg = 1;
 		strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
-	else {
-		if (verbosity >= 0)
-			printf("%s\n", msg);
+	} else {
 		strbuf_addf(&reflog_message, "%s: %s",
 			getenv("GIT_REFLOG_ACTION"), msg);
 	}
@@ -409,6 +409,9 @@ static void finish(struct commit *head_commit,
 		diff_flush(&opts);
 	}
 
+	if (!automsg && verbosity >= 0)
+		printf("%s\n", msg);
+
 	/* Run a post-merge hook */
 	run_hook(NULL, "post-merge", squash ? "1" : "0", NULL);
 
-- 
1.7.4.4
Previous: Linus TorvaldsNext: Junio C Hamano
Message 16 of 20 in “Re: Regulator updates for 3.3”
  1. Linus TorvaldsJan 10, 2012
  2. Mark BrownJan 10, 2012
  3. Junio C HamanoJan 11, 2012
  4. Linus TorvaldsJan 11, 2012
  5. Junio C HamanoJan 11, 2012
  6. Linus TorvaldsJan 11, 2012
  7. Re* Regulator updates for 3.3Junio C Hamano, Jan 11, 2012
  8. Phil HordJan 11, 2012
  9. Linus TorvaldsJan 11, 2012
  10. Pete HarlanJan 16, 2012
  11. Junio C HamanoJan 16, 2012
  12. Martin FickJan 16, 2012
  13. Pete HarlanJan 17, 2012
  14. Junio C HamanoJan 17, 2012
  15. Linus TorvaldsJan 11, 2012
  16. Paul GortmakerJan 11, 2012
  17. Junio C HamanoJan 13, 2012
  18. Nguyen Thai Ngoc DuyJan 13, 2012
  19. Linus TorvaldsJan 13, 2012
  20. Miles BaderJan 17, 2012

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.