Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Dec 2, 2009
2 parents c86485d + 28044ba commit 0748494
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
32 changes: 32 additions & 0 deletions Documentation/RelNotes-1.6.5.4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Git v1.6.5.4 Release Notes
==========================

Fixes since v1.6.5.3
--------------------

* "git help" (without argument) used to check if you are in a directory
under git control. There was no breakage in behaviour per-se, but this
was unnecessary.

* "git prune-packed" gave progress output even when its standard error is
not connected to a terminal; this caused cron jobs that run it to
produce crufts.

* "git pack-objects --all-progress" is an option to ask progress output
from write-object phase _if_ progress output were to be produced, and
shouldn't have forced the progress output.

* "git apply -p<n> --directory=<elsewhere>" did not work well for a
non-default value of n.

* "git merge foo HEAD" was misparsed as an old-style invocation of the
command and produced a confusing error message. As it does not specify
any other branch to merge, it shouldn't be mistaken as such. We will
remove the old style "git merge <message> HEAD <commit>..." syntax in
future versions, but not in this release,

* "git merge -m <message> <branch>..." added the standard merge message
on its own after user-supplied message, which should have overrided the
standard one.

Other minor documentation updates are included.
16 changes: 9 additions & 7 deletions builtin-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int option_parse_message(const struct option *opt,
if (unset)
strbuf_setlen(buf, 0);
else if (arg) {
strbuf_addf(buf, "%s\n\n", arg);
strbuf_addf(buf, "%s%s", buf->len ? "\n\n" : "", arg);
have_message = 1;
} else
return error("switch `m' requires a value");
Expand Down Expand Up @@ -804,7 +804,7 @@ static const char deprecation_warning[] =
static struct commit *is_old_style_invocation(int argc, const char **argv)
{
struct commit *second_token = NULL;
if (argc > 1) {
if (argc > 2) {
unsigned char second_sha1[20];

if (get_sha1(argv[1], second_sha1))
Expand Down Expand Up @@ -943,11 +943,13 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* codepath so we discard the error in this
* loop.
*/
for (i = 0; i < argc; i++)
merge_name(argv[i], &msg);
fmt_merge_msg(option_log, &msg, &merge_msg);
if (merge_msg.len)
strbuf_setlen(&merge_msg, merge_msg.len-1);
if (!have_message) {
for (i = 0; i < argc; i++)
merge_name(argv[i], &msg);
fmt_merge_msg(option_log, &msg, &merge_msg);
if (merge_msg.len)
strbuf_setlen(&merge_msg, merge_msg.len-1);
}
}

if (head_invalid || !argc)
Expand Down
7 changes: 2 additions & 5 deletions t/t7604-merge-custom-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ test_expect_success 'setup' '
git tag c2
'

cat >expected <<\EOF
custom message

Merge commit 'c2'
EOF
test_expect_success 'merge c2 with a custom message' '
git reset --hard c1 &&
echo >expected "custom message" &&
git merge -m "custom message" c2 &&
git cat-file commit HEAD | sed -e "1,/^$/d" > actual &&
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
test_cmp expected actual
'

Expand Down

0 comments on commit 0748494

Please sign in to comment.