pretty: allow tweaking tabwidth in --expand-tabs
When the local convention of the project is to use tab width that is not 8, it may make sense to allow "git log --expand-tabs=<n>" to tweak the output to match it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -1415,7 +1415,7 @@ void init_revisions(struct rev_info *revs, const char *prefix)
|
||||
revs->expand_tabs_in_log = -1;
|
||||
|
||||
revs->commit_format = CMIT_FMT_DEFAULT;
|
||||
revs->expand_tabs_in_log_default = 1;
|
||||
revs->expand_tabs_in_log_default = 8;
|
||||
|
||||
init_grep_defaults();
|
||||
grep_init(&revs->grep_filter, prefix);
|
||||
@ -1918,9 +1918,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
||||
revs->pretty_given = 1;
|
||||
get_commit_format(arg+9, revs);
|
||||
} else if (!strcmp(arg, "--expand-tabs")) {
|
||||
revs->expand_tabs_in_log = 1;
|
||||
revs->expand_tabs_in_log = 8;
|
||||
} else if (!strcmp(arg, "--no-expand-tabs")) {
|
||||
revs->expand_tabs_in_log = 0;
|
||||
} else if (skip_prefix(arg, "--expand-tabs=", &arg)) {
|
||||
int val;
|
||||
if (strtol_i(arg, 10, &val) < 0 || val < 0)
|
||||
die("'%s': not a non-negative integer", arg);
|
||||
revs->expand_tabs_in_log = val;
|
||||
} else if (!strcmp(arg, "--show-notes") || !strcmp(arg, "--notes")) {
|
||||
revs->show_notes = 1;
|
||||
revs->show_notes_given = 1;
|
||||
|
||||
Reference in New Issue
Block a user