@matheusbsbs / matheus-bagliano / commits / 6cd9cfefc5
Fork 0

fmt-merge-msg: add '--(no-)log' options and 'merge.log' config variable

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 <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Apr 6, 2008 at 03:23 UTC 6cd9cfefc505ed5ab5ff435ff9ef338ac8721225
4 files changed +75 -13
Documentation/git-fmt-merge-msg.txt
+13 -5
@@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message
9 SYNOPSIS
10 --------
11 [verse]
12 -git-fmt-merge-msg [--summary | --no-summary] <$GIT_DIR/FETCH_HEAD
13 -git-fmt-merge-msg [--summary | --no-summary] -F <file>
12 +git-fmt-merge-msg [--log | --no-log] <$GIT_DIR/FETCH_HEAD
13 +git-fmt-merge-msg [--log | --no-log] -F <file>
14
15 DESCRIPTION
16 -----------
@@ -24,15 +24,19 @@ automatically invoking `git-merge`.
24 OPTIONS
25 -------
26
27 ---summary::
27 +--log::
28 In addition to branch names, populate the log message with
29 one-line descriptions from the actual commits that are being
30 merged.
31
32 ---no-summary::
32 +--no-log::
33 Do not list one-line descriptions from the actual commits being
34 merged.
35
36 +--summary,--no-summary::
37 + Synonyms to --log and --no-log; these are deprecated and will be
38 + removed in the future.
39 +
40 --file <file>, -F <file>::
41 Take the list of merged objects from <file> instead of
42 stdin.
@@ -40,10 +44,14 @@ OPTIONS
44 CONFIGURATION
45 -------------
46
43 -merge.summary::
47 +merge.log::
48 Whether to include summaries of merged commits in newly
49 merge commit messages. False by default.
50
51 +merge.summary::
52 + Synonym to `merge.log`; this is deprecated and will be removed in
53 + the future.
54 +
55 SEE ALSO
56 --------
57 linkgit:git-merge[1]
Documentation/merge-config.txt
+1 -1
@@ -2,7 +2,7 @@ merge.stat::
2 Whether to print the diffstat berween ORIG_HEAD and merge result
3 at the end of the merge. True by default.
4
5 -merge.summary::
5 +merge.log::
6 Whether to include summaries of merged commits in newly created
7 merge commit messages. False by default.
8
builtin-fmt-merge-msg.c
+10 -4
@@ -6,13 +6,18 @@
6 #include "tag.h"
7
8 static const char *fmt_merge_msg_usage =
9 - "git-fmt-merge-msg [--summary] [--no-summary] [--file <file>]";
9 + "git-fmt-merge-msg [--log] [--no-log] [--file <file>]";
10
11 static int merge_summary;
12
13 static int fmt_merge_msg_config(const char *key, const char *value)
14 {
15 - if (!strcmp("merge.summary", key))
15 + static int found_merge_log = 0;
16 + if (!strcmp("merge.log", key)) {
17 + found_merge_log = 1;
18 + merge_summary = git_config_bool(key, value);
19 + }
20 + if (!found_merge_log && !strcmp("merge.summary", key))
21 merge_summary = git_config_bool(key, value);
22 return 0;
23 }
@@ -250,9 +255,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
255 git_config(fmt_merge_msg_config);
256
257 while (argc > 1) {
253 - if (!strcmp(argv[1], "--summary"))
258 + if (!strcmp(argv[1], "--log") || !strcmp(argv[1], "--summary"))
259 merge_summary = 1;
255 - else if (!strcmp(argv[1], "--no-summary"))
260 + else if (!strcmp(argv[1], "--no-log")
261 + || !strcmp(argv[1], "--no-summary"))
262 merge_summary = 0;
263 else if (!strcmp(argv[1], "-F") || !strcmp(argv[1], "--file")) {
264 if (argc < 3)
t/t6200-fmt-merge-msg.sh
+51 -3
@@ -106,8 +106,24 @@ Merge branch 'left'
106 Common #1
107 EOF
108
109 -test_expect_success 'merge-msg test #3' '
109 +test_expect_success 'merge-msg test #3-1' '
110
111 + git config --unset-all merge.log
112 + git config --unset-all merge.summary
113 + git config merge.log true &&
114 +
115 + git checkout master &&
116 + setdate &&
117 + git fetch . left &&
118 +
119 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
120 + git diff actual expected
121 +'
122 +
123 +test_expect_success 'merge-msg test #3-2' '
124 +
125 + git config --unset-all merge.log
126 + git config --unset-all merge.summary
127 git config merge.summary true &&
128
129 git checkout master &&
@@ -136,8 +152,24 @@ Merge branches 'left' and 'right'
152 Common #1
153 EOF
154
139 -test_expect_success 'merge-msg test #4' '
155 +test_expect_success 'merge-msg test #4-1' '
156 +
157 + git config --unset-all merge.log
158 + git config --unset-all merge.summary
159 + git config merge.log true &&
160 +
161 + git checkout master &&
162 + setdate &&
163 + git fetch . left right &&
164 +
165 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
166 + git diff actual expected
167 +'
168 +
169 +test_expect_success 'merge-msg test #4-2' '
170
171 + git config --unset-all merge.log
172 + git config --unset-all merge.summary
173 git config merge.summary true &&
174
175 git checkout master &&
@@ -148,8 +180,24 @@ test_expect_success 'merge-msg test #4' '
180 git diff actual expected
181 '
182
151 -test_expect_success 'merge-msg test #5' '
183 +test_expect_success 'merge-msg test #5-1' '
184 +
185 + git config --unset-all merge.log
186 + git config --unset-all merge.summary
187 + git config merge.log yes &&
188 +
189 + git checkout master &&
190 + setdate &&
191 + git fetch . left right &&
192 +
193 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
194 + git diff actual expected
195 +'
196 +
197 +test_expect_success 'merge-msg test #5-2' '
198
199 + git config --unset-all merge.log
200 + git config --unset-all merge.summary
201 git config merge.summary yes &&
202
203 git checkout master &&