mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
diff-merges: introduce log.diffMerges config variable
New log.diffMerges configuration variable sets the format that --diff-merges=on will be using. The default is "separate". t4013: add the following tests for log.diffMerges config: * Test that wrong values are denied. * Test that the value of log.diffMerges properly affects both --diff-merges=on and -m. t9902: fix completion tests for log.d* to match log.diffMerges. Added documentation for log.diffMerges. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
38fc4dbbc2
commit
17c13e60fd
@ -24,6 +24,11 @@ log.excludeDecoration::
|
|||||||
the config option can be overridden by the `--decorate-refs`
|
the config option can be overridden by the `--decorate-refs`
|
||||||
option.
|
option.
|
||||||
|
|
||||||
|
log.diffMerges::
|
||||||
|
Set default diff format to be used for merge commits. See
|
||||||
|
`--diff-merges` in linkgit:git-log[1] for details.
|
||||||
|
Defaults to `separate`.
|
||||||
|
|
||||||
log.follow::
|
log.follow::
|
||||||
If `true`, `git log` will act as if the `--follow` option was used when
|
If `true`, `git log` will act as if the `--follow` option was used when
|
||||||
a single <path> is given. This has the same limitations as `--follow`,
|
a single <path> is given. This has the same limitations as `--follow`,
|
||||||
|
@ -481,6 +481,8 @@ static int git_log_config(const char *var, const char *value, void *cb)
|
|||||||
decoration_style = 0; /* maybe warn? */
|
decoration_style = 0; /* maybe warn? */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(var, "log.diffmerges"))
|
||||||
|
return diff_merges_config(value);
|
||||||
if (!strcmp(var, "log.showroot")) {
|
if (!strcmp(var, "log.showroot")) {
|
||||||
default_show_root = git_config_bool(var, value);
|
default_show_root = git_config_bool(var, value);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -90,6 +90,17 @@ static void set_diff_merges(struct rev_info *revs, const char *optarg)
|
|||||||
* Public functions. They are in the order they are called.
|
* Public functions. They are in the order they are called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int diff_merges_config(const char *value)
|
||||||
|
{
|
||||||
|
diff_merges_setup_func_t func = func_by_opt(value);
|
||||||
|
|
||||||
|
if (!func)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
set_to_default = func;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
||||||
{
|
{
|
||||||
int argcount = 1;
|
int argcount = 1;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
struct rev_info;
|
struct rev_info;
|
||||||
|
|
||||||
|
int diff_merges_config(const char *value);
|
||||||
|
|
||||||
int diff_merges_parse_opts(struct rev_info *revs, const char **argv);
|
int diff_merges_parse_opts(struct rev_info *revs, const char **argv);
|
||||||
|
|
||||||
void diff_merges_suppress(struct rev_info *revs);
|
void diff_merges_suppress(struct rev_info *revs);
|
||||||
|
@ -460,6 +460,29 @@ test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'deny wrong log.diffMerges config' '
|
||||||
|
test_config log.diffMerges wrong-value &&
|
||||||
|
test_expect_code 128 git log
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git config log.diffMerges first-parent' '
|
||||||
|
git log -p --diff-merges=first-parent master >result &&
|
||||||
|
process_diffs result >expected &&
|
||||||
|
test_config log.diffMerges first-parent &&
|
||||||
|
git log -p --diff-merges=on master >result &&
|
||||||
|
process_diffs result >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git config log.diffMerges first-parent vs -m' '
|
||||||
|
git log -p --diff-merges=first-parent master >result &&
|
||||||
|
process_diffs result >expected &&
|
||||||
|
test_config log.diffMerges first-parent &&
|
||||||
|
git log -p -m master >result &&
|
||||||
|
process_diffs result >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'log -S requires an argument' '
|
test_expect_success 'log -S requires an argument' '
|
||||||
test_must_fail git log -S
|
test_must_fail git log -S
|
||||||
'
|
'
|
||||||
|
@ -2306,6 +2306,7 @@ test_expect_success 'git config - variable name' '
|
|||||||
test_completion "git config log.d" <<-\EOF
|
test_completion "git config log.d" <<-\EOF
|
||||||
log.date Z
|
log.date Z
|
||||||
log.decorate Z
|
log.decorate Z
|
||||||
|
log.diffMerges Z
|
||||||
EOF
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -2327,6 +2328,7 @@ test_expect_success 'git -c - variable name' '
|
|||||||
test_completion "git -c log.d" <<-\EOF
|
test_completion "git -c log.d" <<-\EOF
|
||||||
log.date=Z
|
log.date=Z
|
||||||
log.decorate=Z
|
log.decorate=Z
|
||||||
|
log.diffMerges=Z
|
||||||
EOF
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -2348,6 +2350,7 @@ test_expect_success 'git clone --config= - variable name' '
|
|||||||
test_completion "git clone --config=log.d" <<-\EOF
|
test_completion "git clone --config=log.d" <<-\EOF
|
||||||
log.date=Z
|
log.date=Z
|
||||||
log.decorate=Z
|
log.decorate=Z
|
||||||
|
log.diffMerges=Z
|
||||||
EOF
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user