@matheusbsbs / matheus-bagliano / commits / 69a8b7c741
Fork 0

merge: indicate remote tracking branches in merge message

Previously when merging directly from a local tracking branch like: git merge origin/master The merge message said: Merge commit 'origin/master' * commit 'origin/master': ... Instead, let's be more explicit about what we are merging: Merge remote branch 'origin/master' * origin/master: ... We accomplish this by recognizing remote tracking branches in git-merge when we build the simulated FETCH_HEAD output that we feed to fmt-merge-msg. In addition to a new test in t7608, we have to tweak the expected output of t3409, which does such a merge. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 9, 2009 at 06:02 UTC 69a8b7c74192dfa7bde3937d2c84324a2cd1506b
3 files changed +16 -1
builtin-merge.c
+5
@@ -375,6 +375,11 @@ static void merge_name(const char *remote, struct strbuf *msg)
375 sha1_to_hex(branch_head), remote);
376 goto cleanup;
377 }
378 + if (!prefixcmp(found_ref, "refs/remotes/")) {
379 + strbuf_addf(msg, "%s\t\tremote branch '%s' of .\n",
380 + sha1_to_hex(branch_head), remote);
381 + goto cleanup;
382 + }
383 }
384
385 /* See if remote matches <name>^^^.. or <name>~<number> */
t/t3409-rebase-preserve-merges.sh
+1 -1
@@ -71,7 +71,7 @@ test_expect_success 'rebase -p fakes interactive rebase' '
71 git fetch &&
72 git rebase -p origin/topic &&
73 test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
74 - test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
74 + test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote branch " | wc -l)
75 )
76 '
77
t/t7608-merge-messages.sh
+10
@@ -47,4 +47,14 @@ test_expect_success 'ambiguous tag' '
47 check_oneline "Merge commit QambiguousQ"
48 '
49
50 +test_expect_success 'remote branch' '
51 + git checkout -b remote master &&
52 + test_commit remote-1 &&
53 + git update-ref refs/remotes/origin/master remote &&
54 + git checkout master &&
55 + test_commit master-5 &&
56 + git merge origin/master &&
57 + check_oneline "Merge remote branch Qorigin/masterQ"
58 +'
59 +
60 test_done