diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-03-29 15:49:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-30 12:39:29 -0700 |
commit | 0893eec85fca0f76039a96cbbcd3592ff8571c24 (patch) | |
tree | 2be9e1683a91699d45472fe1b0d899c864a37558 /revision.c | |
parent | 7cc13c717b52d3539e76f087d747f96d0d24a914 (diff) | |
download | git-0893eec85fca0f76039a96cbbcd3592ff8571c24.tar.gz |
pretty: enable --expand-tabs by default for selected pretty formats
"git log --pretty={medium,full,fuller}" and "git log" by default
prepend 4 spaces to the log message, so it makes sense to enable
the new "expand-tabs" facility by default for these formats.
Add --no-expand-tabs option to override the new default.
The change alone breaks a test in t4201 that runs "git shortlog"
on the output from "git log", and expects that the output from
"git log" does not do such a tab expansion. Adjust the test to
explicitly disable expand-tabs with --no-expand-tabs.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/revision.c b/revision.c index e662230ff1..da53b6ce35 100644 --- a/revision.c +++ b/revision.c @@ -1412,8 +1412,10 @@ void init_revisions(struct rev_info *revs, const char *prefix) revs->skip_count = -1; revs->max_count = -1; revs->max_parents = -1; + revs->expand_tabs_in_log = -1; revs->commit_format = CMIT_FMT_DEFAULT; + revs->expand_tabs_in_log_default = 1; init_grep_defaults(); grep_init(&revs->grep_filter, prefix); @@ -1917,6 +1919,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg get_commit_format(arg+9, revs); } else if (!strcmp(arg, "--expand-tabs")) { revs->expand_tabs_in_log = 1; + } else if (!strcmp(arg, "--no-expand-tabs")) { + revs->expand_tabs_in_log = 0; } else if (!strcmp(arg, "--show-notes") || !strcmp(arg, "--notes")) { revs->show_notes = 1; revs->show_notes_given = 1; @@ -2390,6 +2394,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s if (revs->first_parent_only && revs->bisect) die(_("--first-parent is incompatible with --bisect")); + if (revs->expand_tabs_in_log < 0) + revs->expand_tabs_in_log = revs->expand_tabs_in_log_default; + return left; } |