diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-03-29 16:05:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-30 12:52:26 -0700 |
commit | fe37a9c586a65943e1bca327a1bbe1ca4a3d3023 (patch) | |
tree | fdb9dc30ad33ead3e710560a3c04e2cfee49a2e3 /revision.c | |
parent | 0893eec85fca0f76039a96cbbcd3592ff8571c24 (diff) | |
download | git-fe37a9c586a65943e1bca327a1bbe1ca4a3d3023.tar.gz |
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>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/revision.c b/revision.c index da53b6ce35..47e9ee7a14 100644 --- a/revision.c +++ b/revision.c @@ -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; |