[PATCH] merge: Make merge strategy message follow the diffstat

From: Paul Gortmaker
Date: Wed Jan 11 2012 - 10:33:45 EST


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@xxxxxxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/