aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/config.txt32
-rw-r--r--Documentation/git-fmt-merge-msg.txt18
-rw-r--r--Documentation/git-merge.txt15
-rw-r--r--Documentation/merge-config.txt35
-rw-r--r--Documentation/merge-options.txt19
-rw-r--r--builtin-fmt-merge-msg.c14
-rwxr-xr-xcontrib/completion/git-completion.bash2
-rwxr-xr-xgit-merge.sh19
-rwxr-xr-xgit-pull.sh20
-rwxr-xr-xt/t6200-fmt-merge-msg.sh54
-rwxr-xr-xt/t7600-merge.sh39
11 files changed, 186 insertions, 81 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 7a91ac16f..a102729fa 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -809,37 +809,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.<tool>.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.<driver>.name::
- Defines a human readable name for a custom low-level
- merge driver. See linkgit:gitattributes[5] for details.
-
-merge.<driver>.driver::
- Defines the command that implements a custom low-level
- merge driver. See linkgit:gitattributes[5] for details.
-
-merge.<driver>.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[]
man.<tool>.cmd::
Specify the command to invoke the specified man viewer. The
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 <file>
+git-fmt-merge-msg [--log | --no-log] <$GIT_DIR/FETCH_HEAD
+git-fmt-merge-msg [--log | --no-log] -F <file>
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 <file>, -F <file>::
Take the list of merged objects from <file> 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/git-merge.txt b/Documentation/git-merge.txt
index c136b1069..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 <strategy>]...
+'git-merge' [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]...
[-m <msg>] <remote> <remote>...
'git-merge' <msg> HEAD <remote>...
@@ -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.<name>.mergeoptions::
Sets default options for merging into branch <name>. The syntax and
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
new file mode 100644
index 000000000..9719311b4
--- /dev/null
+++ b/Documentation/merge-config.txt
@@ -0,0 +1,35 @@
+merge.stat::
+ Whether to print the diffstat berween ORIG_HEAD and merge result
+ at the end of the merge. True by default.
+
+merge.log::
+ 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.<tool>.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.<driver>.name::
+ Defines a human readable name for a custom low-level
+ merge driver. See linkgit:gitattributes[5] for details.
+
+merge.<driver>.driver::
+ Defines the command that implements a custom low-level
+ merge driver. See linkgit:gitattributes[5] for details.
+
+merge.<driver>.recursive::
+ Names a low-level merge driver to be used when
+ performing an internal merge between common ancestors.
+ See linkgit:gitattributes[5] for details.
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 9f1fc8255..f37a77648 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -1,10 +1,23 @@
---summary::
+--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-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.
+
+--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/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 7077d5247..b72cb59e6 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 <file>]";
+ "git-fmt-merge-msg [--log] [--no-log] [--file <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;
}
@@ -258,9 +263,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/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 23db664f4..16984632d 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -780,7 +780,7 @@ _git_merge ()
;;
--*)
__gitcomp "
- --no-commit --no-summary --squash --strategy
+ --no-commit --no-stat --log --no-log --squash --strategy
"
return
esac
diff --git a/git-merge.sh b/git-merge.sh
index 7dbbb1d79..69b35d87e 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -8,8 +8,12 @@ OPTIONS_SPEC="\
git-merge [options] <remote>...
git-merge [options] <msg> HEAD <remote>
--
-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)
+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)
@@ -37,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" \
@@ -148,10 +152,12 @@ 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 ;;
+ --log|--no-log)
+ log_arg=$1 ;;
--squash)
test "$allow_fast_forward" = t ||
die "You cannot combine --squash with --no-ff."
@@ -210,6 +216,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
@@ -258,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 3ce32b5f2..bf0c2985a 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]... [<fetch-options>] <repo> <head>...'
+USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [<fetch-options>] <repo> <head>...'
LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
@@ -16,19 +16,19 @@ 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= 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)
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 ;;
+ --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)
@@ -172,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_summary $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/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 &&
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 56869acee..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() {
@@ -364,7 +368,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 +377,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 &&
@@ -441,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