summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-03-10 23:54:33 -0400
committerJunio C Hamano <gitster@pobox.com>2019-03-11 16:31:07 +0900
commit05314efaeaa0ae7cb0aa26d6347eabfe7cd8fc43 (patch)
tree75288aa04e8f62cb91b53a84d9f44d3f2cb6e772 /revision.c
parent9f607cd09c4c953d76de4bd18ba1c9bf6cf383cd (diff)
downloadgit-05314efaeaa0ae7cb0aa26d6347eabfe7cd8fc43.tar.gz
line-log: detect unsupported formats
If you use "log -L" with an output format like "--raw" or "--stat", we'll silently ignore the format and just output the normal patch. Let's detect and complain about this, which at least tells the user what's going on. The tests here aren't exhaustive over the set of all formats, but it should at least let us know if somebody breaks the format-checking. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 162d511d46..fc4f33fdd5 100644
--- a/revision.c
+++ b/revision.c
@@ -2683,6 +2683,10 @@ 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->line_level_traverse &&
+ (revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT)))
+ die(_("-L does not yet support diff formats besides -p and -s"));
+
if (revs->expand_tabs_in_log < 0)
revs->expand_tabs_in_log = revs->expand_tabs_in_log_default;