From f5a84c372f8f044899dde91f1a415d2bf963377e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 6 Apr 2008 03:23:42 +0200 Subject: doc: moved merge.* config variables into separate merge-config.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include the new file from config.txt and git-merge.txt. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- Documentation/config.txt | 32 +------------------------------- Documentation/git-merge.txt | 13 +------------ Documentation/merge-config.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 43 deletions(-) create mode 100644 Documentation/merge-config.txt diff --git a/Documentation/config.txt b/Documentation/config.txt index fe43b1257..bef612705 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -768,37 +768,7 @@ man.viewer:: Specify the programs that may be used to display help in the 'man' format. See linkgit:git-help[1]. -merge.summary:: - Whether to include summaries of merged commits in newly created - merge commit messages. False by default. - -merge.tool:: - Controls which merge resolution program is used by - linkgit:git-mergetool[1]. Valid built-in values are: "kdiff3", - "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and - "opendiff". Any other value is treated is custom merge tool - and there must be a corresponing mergetool..cmd option. - -merge.verbosity:: - Controls the amount of output shown by the recursive merge - strategy. Level 0 outputs nothing except a final error - message if conflicts were detected. Level 1 outputs only - conflicts, 2 outputs conflicts and file changes. Level 5 and - above outputs debugging information. The default is level 2. - Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable. - -merge..name:: - Defines a human readable name for a custom low-level - merge driver. See linkgit:gitattributes[5] for details. - -merge..driver:: - Defines the command that implements a custom low-level - merge driver. See linkgit:gitattributes[5] for details. - -merge..recursive:: - Names a low-level merge driver to be used when - performing an internal merge between common ancestors. - See linkgit:gitattributes[5] for details. +include::merge-config.txt[] mergetool..path:: Override the path for the given tool. This is useful in case diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index c136b1069..821e21bba 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -46,18 +46,7 @@ linkgit:git-reset[1]. CONFIGURATION ------------- - -merge.summary:: - Whether to include summaries of merged commits in newly - created merge commit. False by default. - -merge.verbosity:: - Controls the amount of output shown by the recursive merge - strategy. Level 0 outputs nothing except a final error - message if conflicts were detected. Level 1 outputs only - conflicts, 2 outputs conflicts and file changes. Level 5 and - above outputs debugging information. The default is level 2. - Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable. +include::merge-config.txt[] branch..mergeoptions:: Sets default options for merging into branch . The syntax and diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt new file mode 100644 index 000000000..cc815cc21 --- /dev/null +++ b/Documentation/merge-config.txt @@ -0,0 +1,31 @@ +merge.summary:: + Whether to include summaries of merged commits in newly created + merge commit messages. False by default. + +merge.tool:: + Controls which merge resolution program is used by + linkgit:git-mergetool[1]. Valid built-in values are: "kdiff3", + "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and + "opendiff". Any other value is treated is custom merge tool + and there must be a corresponing mergetool..cmd option. + +merge.verbosity:: + Controls the amount of output shown by the recursive merge + strategy. Level 0 outputs nothing except a final error + message if conflicts were detected. Level 1 outputs only + conflicts, 2 outputs conflicts and file changes. Level 5 and + above outputs debugging information. The default is level 2. + Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable. + +merge..name:: + Defines a human readable name for a custom low-level + merge driver. See linkgit:gitattributes[5] for details. + +merge..driver:: + Defines the command that implements a custom low-level + merge driver. See linkgit:gitattributes[5] for details. + +merge..recursive:: + Names a low-level merge driver to be used when + performing an internal merge between common ancestors. + See linkgit:gitattributes[5] for details. -- cgit v1.2.1 From d8abe148bece83f6c3e5ebe6075aef236322ed74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 6 Apr 2008 03:23:43 +0200 Subject: merge, pull: introduce '--(no-)stat' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option has the same effect as '--(no-)summary' (i.e. whether to show a diffsat at the end of the merge or not), and it is consistent with the '--stat' option of other git commands. Documentation, tests, and bash completion are updaed accordingly, and the old --summary option is marked as being deprected. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- Documentation/git-merge.txt | 2 +- Documentation/merge-options.txt | 8 ++++++-- contrib/completion/git-completion.bash | 2 +- git-merge.sh | 10 ++++++---- git-pull.sh | 16 +++++++--------- t/t7600-merge.sh | 23 +++++++++++++++++++---- 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 821e21bba..ef1f055c8 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -9,7 +9,7 @@ git-merge - Join two or more development histories together SYNOPSIS -------- [verse] -'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s ]... +'git-merge' [-n] [--stat] [--no-commit] [--squash] [-s ]... [-m ] ... 'git-merge' HEAD ... diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 9f1fc8255..790417264 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -1,10 +1,14 @@ ---summary:: +--stat:: Show a diffstat at the end of the merge. The diffstat is also controlled by the configuration option merge.diffstat. --n, \--no-summary:: +-n, \--no-stat:: Do not show diffstat at the end of the merge. +--summary, \--no-summary:: + Synonyms to --stat and --no-stat; these are deprecated and will be + removed in the future. + --no-commit:: Perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 4d81963b1..0f54cfd8a 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -779,7 +779,7 @@ _git_merge () ;; --*) __gitcomp " - --no-commit --no-summary --squash --strategy + --no-commit --no-stat --squash --strategy " return esac diff --git a/git-merge.sh b/git-merge.sh index 7dbbb1d79..0b1592400 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -8,8 +8,10 @@ OPTIONS_SPEC="\ git-merge [options] ... git-merge [options] HEAD -- -summary show a diffstat at the end of the merge -n,no-summary don't show a diffstat at the end of the merge +stat show a diffstat at the end of the merge +n,no-stat don't show a diffstat at the end of the merge +summary (synonym to --stat) +no-summary (synonym to --no-stat) squash create a single commit instead of doing a merge commit perform a commit if the merge sucesses (default) ff allow fast forward (default) @@ -148,9 +150,9 @@ merge_name () { parse_config () { while test $# != 0; do case "$1" in - -n|--no-summary) + -n|--no-stat|--no-summary) show_diffstat=false ;; - --summary) + --stat|--summary) show_diffstat=t ;; --squash) test "$allow_fast_forward" = t || diff --git a/git-pull.sh b/git-pull.sh index 3ce32b5f2..ed83ce1e4 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -4,7 +4,7 @@ # # Fetch one or more remote refs and merge it/them into the current HEAD. -USAGE='[-n | --no-summary] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [] ...' +USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [] ...' LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.' SUBDIRECTORY_OK=Yes OPTIONS_SPEC= @@ -16,19 +16,17 @@ cd_to_toplevel test -z "$(git ls-files -u)" || die "You are in the middle of a conflicted merge." -strategy_args= no_summary= no_commit= squash= no_ff= +strategy_args= no_stat= no_commit= squash= no_ff= curr_branch=$(git symbolic-ref -q HEAD) curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||") rebase=$(git config --bool branch.$curr_branch_short.rebase) while : do case "$1" in - -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ - --no-summa|--no-summar|--no-summary) - no_summary=-n ;; - --summary) - no_summary=$1 - ;; + -n|--no-stat|--no-summary) + no_stat=-n ;; + --stat|--summary) + no_stat=$1 ;; --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) no_commit=--no-commit ;; --c|--co|--com|--comm|--commi|--commit) @@ -176,5 +174,5 @@ merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit test true = "$rebase" && exec git-rebase $strategy_args --onto $merge_head \ ${oldremoteref:-$merge_head} -exec git-merge $no_summary $no_commit $squash $no_ff $strategy_args \ +exec git-merge $no_stat $no_commit $squash $no_ff $strategy_args \ "$merge_name" HEAD $merge_head diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 56869acee..dd3eb9736 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -364,7 +364,7 @@ test_expect_success 'merge c1 with c2 (squash in config)' ' test_debug 'gitk --all' -test_expect_success 'override config option -n' ' +test_expect_success 'override config option -n with --summary' ' git reset --hard c1 && git config branch.master.mergeoptions "-n" && test_tick && @@ -373,15 +373,30 @@ test_expect_success 'override config option -n' ' verify_parents $c1 $c2 && if ! grep "^ file | *2 +-$" diffstat.txt then - echo "[OOPS] diffstat was not generated" + echo "[OOPS] diffstat was not generated with --summary" + false + fi +' + +test_expect_success 'override config option -n with --stat' ' + git reset --hard c1 && + git config branch.master.mergeoptions "-n" && + test_tick && + git merge --stat c2 >diffstat.txt && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 && + if ! grep "^ file | *2 +-$" diffstat.txt + then + echo "[OOPS] diffstat was not generated with --stat" + false fi ' test_debug 'gitk --all' -test_expect_success 'override config option --summary' ' +test_expect_success 'override config option --stat' ' git reset --hard c1 && - git config branch.master.mergeoptions "--summary" && + git config branch.master.mergeoptions "--stat" && test_tick && git merge -n c2 >diffstat.txt && verify_merge file result.1-5 msg.1-5 && -- cgit v1.2.1 From 3e6c0a3fe3dcdbe6621b122a8a498a0d8627b425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 6 Apr 2008 03:23:44 +0200 Subject: add 'merge.stat' config variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This variable has the same effect, as 'merge.diffstat'. Also mention it in the documentation. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- Documentation/merge-config.txt | 4 ++++ Documentation/merge-options.txt | 2 +- git-merge.sh | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt index cc815cc21..6d0a7971c 100644 --- a/Documentation/merge-config.txt +++ b/Documentation/merge-config.txt @@ -1,3 +1,7 @@ +merge.stat:: + Whether to print the diffstat berween ORIG_HEAD and merge result + at the end of the merge. True by default. + merge.summary:: Whether to include summaries of merged commits in newly created merge commit messages. False by default. diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 790417264..d4af5e266 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -1,6 +1,6 @@ --stat:: Show a diffstat at the end of the merge. The diffstat is also - controlled by the configuration option merge.diffstat. + controlled by the configuration option merge.stat. -n, \--no-stat:: Do not show diffstat at the end of the merge. diff --git a/git-merge.sh b/git-merge.sh index 0b1592400..793c01555 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -212,6 +212,7 @@ while test $args_left -lt $#; do shift; done if test -z "$show_diffstat"; then test "$(git config --bool merge.diffstat)" = false && show_diffstat=false + test "$(git config --bool merge.stat)" = false && show_diffstat=false test -z "$show_diffstat" && show_diffstat=t fi -- cgit v1.2.1 From 6cd9cfefc505ed5ab5ff435ff9ef338ac8721225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 6 Apr 2008 03:23:45 +0200 Subject: fmt-merge-msg: add '--(no-)log' options and 'merge.log' config variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are new synonyms to the '--(no-)summary' option and the 'merge.summary' config variable, but are consistent with the soon to be added 'merge --(no-)log' options. The 'merge.summary' config variable and '--(no-)summary' options are still accepted, but are advertised to be removed in the future. 'merge.log' takes precedence over 'merge.summary' if they are both set inconsistently. Update documentation and tests accordingly. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- Documentation/git-fmt-merge-msg.txt | 18 +++++++++---- Documentation/merge-config.txt | 2 +- builtin-fmt-merge-msg.c | 14 +++++++--- t/t6200-fmt-merge-msg.sh | 54 ++++++++++++++++++++++++++++++++++--- 4 files changed, 75 insertions(+), 13 deletions(-) diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt index 8615ae353..457cf4256 100644 --- a/Documentation/git-fmt-merge-msg.txt +++ b/Documentation/git-fmt-merge-msg.txt @@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message SYNOPSIS -------- [verse] -git-fmt-merge-msg [--summary | --no-summary] <$GIT_DIR/FETCH_HEAD -git-fmt-merge-msg [--summary | --no-summary] -F +git-fmt-merge-msg [--log | --no-log] <$GIT_DIR/FETCH_HEAD +git-fmt-merge-msg [--log | --no-log] -F DESCRIPTION ----------- @@ -24,15 +24,19 @@ automatically invoking `git-merge`. OPTIONS ------- ---summary:: +--log:: In addition to branch names, populate the log message with one-line descriptions from the actual commits that are being merged. ---no-summary:: +--no-log:: Do not list one-line descriptions from the actual commits being merged. +--summary,--no-summary:: + Synonyms to --log and --no-log; these are deprecated and will be + removed in the future. + --file , -F :: Take the list of merged objects from instead of stdin. @@ -40,10 +44,14 @@ OPTIONS CONFIGURATION ------------- -merge.summary:: +merge.log:: Whether to include summaries of merged commits in newly merge commit messages. False by default. +merge.summary:: + Synonym to `merge.log`; this is deprecated and will be removed in + the future. + SEE ALSO -------- linkgit:git-merge[1] diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt index 6d0a7971c..9719311b4 100644 --- a/Documentation/merge-config.txt +++ b/Documentation/merge-config.txt @@ -2,7 +2,7 @@ merge.stat:: Whether to print the diffstat berween ORIG_HEAD and merge result at the end of the merge. True by default. -merge.summary:: +merge.log:: Whether to include summaries of merged commits in newly created merge commit messages. False by default. diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c index ebb3f37cf..d49f5454e 100644 --- a/builtin-fmt-merge-msg.c +++ b/builtin-fmt-merge-msg.c @@ -6,13 +6,18 @@ #include "tag.h" static const char *fmt_merge_msg_usage = - "git-fmt-merge-msg [--summary] [--no-summary] [--file ]"; + "git-fmt-merge-msg [--log] [--no-log] [--file ]"; static int merge_summary; static int fmt_merge_msg_config(const char *key, const char *value) { - if (!strcmp("merge.summary", key)) + static int found_merge_log = 0; + if (!strcmp("merge.log", key)) { + found_merge_log = 1; + merge_summary = git_config_bool(key, value); + } + if (!found_merge_log && !strcmp("merge.summary", key)) merge_summary = git_config_bool(key, value); return 0; } @@ -250,9 +255,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) git_config(fmt_merge_msg_config); while (argc > 1) { - if (!strcmp(argv[1], "--summary")) + if (!strcmp(argv[1], "--log") || !strcmp(argv[1], "--summary")) merge_summary = 1; - else if (!strcmp(argv[1], "--no-summary")) + else if (!strcmp(argv[1], "--no-log") + || !strcmp(argv[1], "--no-summary")) merge_summary = 0; else if (!strcmp(argv[1], "-F") || !strcmp(argv[1], "--file")) { if (argc < 3) diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index 526d7d1c4..bd4e49bf1 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -106,8 +106,24 @@ Merge branch 'left' Common #1 EOF -test_expect_success 'merge-msg test #3' ' +test_expect_success 'merge-msg test #3-1' ' + git config --unset-all merge.log + git config --unset-all merge.summary + git config merge.log true && + + git checkout master && + setdate && + git fetch . left && + + git fmt-merge-msg <.git/FETCH_HEAD >actual && + git diff actual expected +' + +test_expect_success 'merge-msg test #3-2' ' + + git config --unset-all merge.log + git config --unset-all merge.summary git config merge.summary true && git checkout master && @@ -136,8 +152,24 @@ Merge branches 'left' and 'right' Common #1 EOF -test_expect_success 'merge-msg test #4' ' +test_expect_success 'merge-msg test #4-1' ' + + git config --unset-all merge.log + git config --unset-all merge.summary + git config merge.log true && + + git checkout master && + setdate && + git fetch . left right && + + git fmt-merge-msg <.git/FETCH_HEAD >actual && + git diff actual expected +' + +test_expect_success 'merge-msg test #4-2' ' + git config --unset-all merge.log + git config --unset-all merge.summary git config merge.summary true && git checkout master && @@ -148,8 +180,24 @@ test_expect_success 'merge-msg test #4' ' git diff actual expected ' -test_expect_success 'merge-msg test #5' ' +test_expect_success 'merge-msg test #5-1' ' + + git config --unset-all merge.log + git config --unset-all merge.summary + git config merge.log yes && + + git checkout master && + setdate && + git fetch . left right && + + git fmt-merge-msg <.git/FETCH_HEAD >actual && + git diff actual expected +' + +test_expect_success 'merge-msg test #5-2' ' + git config --unset-all merge.log + git config --unset-all merge.summary git config merge.summary yes && git checkout master && -- cgit v1.2.1 From efb779f8873e5aa36be29a4e551186c62c1b580c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 6 Apr 2008 03:23:46 +0200 Subject: merge, pull: add '--(no-)log' command line option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are the command line option equivalents of the 'merge.log' config variable. The patch also updates documentation and bash completion accordingly, and adds a test. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- Documentation/merge-options.txt | 9 +++++++++ contrib/completion/git-completion.bash | 2 +- git-merge.sh | 8 ++++++-- git-pull.sh | 8 +++++--- t/t7600-merge.sh | 16 +++++++++++++++- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index d4af5e266..f37a77648 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -9,6 +9,15 @@ Synonyms to --stat and --no-stat; these are deprecated and will be removed in the future. +--log:: + In addition to branch names, populate the log message with + one-line descriptions from the actual commits that are being + merged. + +--no-log:: + Do not list one-line descriptions from the actual commits being + merged. + --no-commit:: Perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 0f54cfd8a..8091d2deb 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -779,7 +779,7 @@ _git_merge () ;; --*) __gitcomp " - --no-commit --no-stat --squash --strategy + --no-commit --no-stat --log --no-log --squash --strategy " return esac diff --git a/git-merge.sh b/git-merge.sh index 793c01555..69b35d87e 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -12,6 +12,8 @@ stat show a diffstat at the end of the merge n,no-stat don't show a diffstat at the end of the merge summary (synonym to --stat) no-summary (synonym to --no-stat) +log add list of one-line log to merge commit message +no-log don't add list of one-line log to merge commit message squash create a single commit instead of doing a merge commit perform a commit if the merge sucesses (default) ff allow fast forward (default) @@ -39,7 +41,7 @@ use_strategies= allow_fast_forward=t allow_trivial_merge=t -squash= no_commit= +squash= no_commit= log_arg= dropsave() { rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \ @@ -154,6 +156,8 @@ parse_config () { show_diffstat=false ;; --stat|--summary) show_diffstat=t ;; + --log|--no-log) + log_arg=$1 ;; --squash) test "$allow_fast_forward" = t || die "You cannot combine --squash with --no-ff." @@ -261,7 +265,7 @@ else merge_name=$(for remote do merge_name "$remote" - done | git fmt-merge-msg + done | git fmt-merge-msg $log_arg ) merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name" fi diff --git a/git-pull.sh b/git-pull.sh index ed83ce1e4..bf0c2985a 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -16,7 +16,7 @@ cd_to_toplevel test -z "$(git ls-files -u)" || die "You are in the middle of a conflicted merge." -strategy_args= no_stat= no_commit= squash= no_ff= +strategy_args= no_stat= no_commit= squash= no_ff= log_arg= curr_branch=$(git symbolic-ref -q HEAD) curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||") rebase=$(git config --bool branch.$curr_branch_short.rebase) @@ -27,6 +27,8 @@ do no_stat=-n ;; --stat|--summary) no_stat=$1 ;; + --log|--no-log) + log_arg=$1 ;; --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) no_commit=--no-commit ;; --c|--co|--com|--comm|--commi|--commit) @@ -170,9 +172,9 @@ then exit fi -merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit +merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit test true = "$rebase" && exec git-rebase $strategy_args --onto $merge_head \ ${oldremoteref:-$merge_head} -exec git-merge $no_stat $no_commit $squash $no_ff $strategy_args \ +exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \ "$merge_name" HEAD $merge_head diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index dd3eb9736..d21cd290d 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -104,7 +104,11 @@ create_merge_msgs() { git log --no-merges ^HEAD c2 >>squash.1-5 && echo "Squashed commit of the following:" >squash.1-5-9 && echo >>squash.1-5-9 && - git log --no-merges ^HEAD c2 c3 >>squash.1-5-9 + git log --no-merges ^HEAD c2 c3 >>squash.1-5-9 && + echo > msg.nolog && + echo "* commit 'c3':" >msg.log && + echo " commit 3" >>msg.log && + echo >>msg.log } verify_diff() { @@ -456,6 +460,16 @@ test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' verify_head $c1 ' +test_expect_success 'merge log message' ' + git reset --hard c0 && + git merge --no-log c2 && + git show -s --pretty=format:%b HEAD >msg.act && + verify_diff msg.nolog msg.act "[OOPS] bad merge log message" && + git merge --log c3 && + git show -s --pretty=format:%b HEAD >msg.act && + verify_diff msg.log msg.act "[OOPS] bad merge log message" +' + test_debug 'gitk --all' test_done -- cgit v1.2.1