mirror of
https://github.com/git/git.git
synced 2026-03-13 02:13:24 +01:00
Merge branch 'sd/log-decorate' into next
* sd/log-decorate: log --pretty/--oneline: ignore log.decorate
This commit is contained in:
@@ -53,6 +53,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
struct rev_info *rev, struct setup_revision_opt *opt)
|
||||
{
|
||||
int i;
|
||||
int decoration_given = 0;
|
||||
|
||||
rev->abbrev = DEFAULT_ABBREV;
|
||||
rev->commit_format = CMIT_FMT_DEFAULT;
|
||||
@@ -91,11 +92,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
const char *arg = argv[i];
|
||||
if (!strcmp(arg, "--decorate")) {
|
||||
decoration_style = DECORATE_SHORT_REFS;
|
||||
decoration_given = 1;
|
||||
} else if (!prefixcmp(arg, "--decorate=")) {
|
||||
const char *v = skip_prefix(arg, "--decorate=");
|
||||
decoration_style = parse_decoration_style(arg, v);
|
||||
if (decoration_style < 0)
|
||||
die("invalid --decorate option: %s", arg);
|
||||
decoration_given = 1;
|
||||
} else if (!strcmp(arg, "--no-decorate")) {
|
||||
decoration_style = 0;
|
||||
} else if (!strcmp(arg, "--source")) {
|
||||
@@ -105,6 +108,14 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||
} else
|
||||
die("unrecognized argument: %s", arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* defeat log.decorate configuration interacting with --pretty
|
||||
* from the command line.
|
||||
*/
|
||||
if (!decoration_given && rev->pretty_given)
|
||||
decoration_style = 0;
|
||||
|
||||
if (decoration_style) {
|
||||
rev->show_decorations = 1;
|
||||
load_ref_decorations(decoration_style);
|
||||
|
||||
@@ -390,50 +390,62 @@ test_expect_success 'log --graph with merge' '
|
||||
test_expect_success 'log.decorate configuration' '
|
||||
git config --unset-all log.decorate || :
|
||||
|
||||
git log --oneline >expect.none &&
|
||||
git log --oneline --decorate >expect.short &&
|
||||
git log --oneline --decorate=full >expect.full &&
|
||||
git log >expect.none &&
|
||||
git log --decorate >expect.short &&
|
||||
git log --decorate=full >expect.full &&
|
||||
git log --oneline >expect.oneline &&
|
||||
|
||||
echo "[log] decorate" >>.git/config &&
|
||||
git log --oneline >actual &&
|
||||
git log >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.oneline actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate true &&
|
||||
git log --oneline >actual &&
|
||||
git log >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --decorate=full >actual &&
|
||||
git log --decorate=full >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
git log --oneline --decorate=no >actual &&
|
||||
git log --decorate=no >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.oneline actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate no &&
|
||||
git log --oneline >actual &&
|
||||
git log >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
git log --oneline --decorate >actual &&
|
||||
git log --decorate >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --decorate=full >actual &&
|
||||
git log --decorate=full >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.oneline actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate short &&
|
||||
git log --oneline >actual &&
|
||||
git log >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --no-decorate >actual &&
|
||||
git log --no-decorate >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
git log --oneline --decorate=full >actual &&
|
||||
git log --decorate=full >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.oneline actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate full &&
|
||||
git log --oneline >actual &&
|
||||
git log >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
git log --oneline --no-decorate >actual &&
|
||||
git log --no-decorate >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
git log --oneline --decorate >actual &&
|
||||
git log --decorate >actual &&
|
||||
test_cmp expect.short actual
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.oneline actual &&
|
||||
|
||||
:
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user