Skip to content

Commit 0748494

Browse files
committed
Merge branch 'maint'
* maint: Prepare for 1.6.5.4 merge: do not add standard message when message is given with -m option Do not misidentify "git merge foo HEAD" as an old-style invocation Conflicts: RelNotes
2 parents c86485d + 28044ba commit 0748494

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

Documentation/RelNotes-1.6.5.4.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Git v1.6.5.4 Release Notes
2+
==========================
3+
4+
Fixes since v1.6.5.3
5+
--------------------
6+
7+
* "git help" (without argument) used to check if you are in a directory
8+
under git control. There was no breakage in behaviour per-se, but this
9+
was unnecessary.
10+
11+
* "git prune-packed" gave progress output even when its standard error is
12+
not connected to a terminal; this caused cron jobs that run it to
13+
produce crufts.
14+
15+
* "git pack-objects --all-progress" is an option to ask progress output
16+
from write-object phase _if_ progress output were to be produced, and
17+
shouldn't have forced the progress output.
18+
19+
* "git apply -p<n> --directory=<elsewhere>" did not work well for a
20+
non-default value of n.
21+
22+
* "git merge foo HEAD" was misparsed as an old-style invocation of the
23+
command and produced a confusing error message. As it does not specify
24+
any other branch to merge, it shouldn't be mistaken as such. We will
25+
remove the old style "git merge <message> HEAD <commit>..." syntax in
26+
future versions, but not in this release,
27+
28+
* "git merge -m <message> <branch>..." added the standard merge message
29+
on its own after user-supplied message, which should have overrided the
30+
standard one.
31+
32+
Other minor documentation updates are included.

builtin-merge.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int option_parse_message(const struct option *opt,
7171
if (unset)
7272
strbuf_setlen(buf, 0);
7373
else if (arg) {
74-
strbuf_addf(buf, "%s\n\n", arg);
74+
strbuf_addf(buf, "%s%s", buf->len ? "\n\n" : "", arg);
7575
have_message = 1;
7676
} else
7777
return error("switch `m' requires a value");
@@ -804,7 +804,7 @@ static const char deprecation_warning[] =
804804
static struct commit *is_old_style_invocation(int argc, const char **argv)
805805
{
806806
struct commit *second_token = NULL;
807-
if (argc > 1) {
807+
if (argc > 2) {
808808
unsigned char second_sha1[20];
809809

810810
if (get_sha1(argv[1], second_sha1))
@@ -943,11 +943,13 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
943943
* codepath so we discard the error in this
944944
* loop.
945945
*/
946-
for (i = 0; i < argc; i++)
947-
merge_name(argv[i], &msg);
948-
fmt_merge_msg(option_log, &msg, &merge_msg);
949-
if (merge_msg.len)
950-
strbuf_setlen(&merge_msg, merge_msg.len-1);
946+
if (!have_message) {
947+
for (i = 0; i < argc; i++)
948+
merge_name(argv[i], &msg);
949+
fmt_merge_msg(option_log, &msg, &merge_msg);
950+
if (merge_msg.len)
951+
strbuf_setlen(&merge_msg, merge_msg.len-1);
952+
}
951953
}
952954

953955
if (head_invalid || !argc)

t/t7604-merge-custom-message.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ test_expect_success 'setup' '
2222
git tag c2
2323
'
2424

25-
cat >expected <<\EOF
26-
custom message
2725

28-
Merge commit 'c2'
29-
EOF
3026
test_expect_success 'merge c2 with a custom message' '
3127
git reset --hard c1 &&
28+
echo >expected "custom message" &&
3229
git merge -m "custom message" c2 &&
33-
git cat-file commit HEAD | sed -e "1,/^$/d" > actual &&
30+
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
3431
test_cmp expected actual
3532
'
3633

0 commit comments

Comments
 (0)