aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-12-07 21:57:01 -0500
committerJunio C Hamano <gitster@pobox.com>2008-12-07 19:59:32 -0800
commite10ea8126c27b079e81932ca487747b4961d0604 (patch)
tree2f484d5f2e298e097034d5dffb539b9d6d6c3689
parent5ec11af61d907311e4e1b21e10009b06dc2cf74a (diff)
downloadgit-e10ea8126c27b079e81932ca487747b4961d0604.tar.gz
git-e10ea8126c27b079e81932ca487747b4961d0604.tar.xz
diff: allow turning on textconv explicitly for plumbing
Some history viewers use the diff plumbing to generate diffs rather than going through the "git diff" porcelain. Currently, there is no way for them to specify that they would like to see the text-converted version of the diff. This patch adds a "--textconv" option to allow such a plumbing user to allow text conversion. The user can then tell the viewer whether or not they would like text conversion enabled. While it may be tempting add a configuration option rather than requiring each plumbing user to be configured to pass --textconv, that is somewhat dangerous. Text-converted diffs generally cannot be applied directly, so each plumbing user should "opt in" to generating such a diff, either by explicit request of the user or by confirming that their output will not be fed to patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--diff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index f644947c8..e21af3b7e 100644
--- a/diff.c
+++ b/diff.c
@@ -2477,6 +2477,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
else if (!strcmp(arg, "--no-ext-diff"))
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
+ else if (!strcmp(arg, "--textconv"))
+ DIFF_OPT_SET(options, ALLOW_TEXTCONV);
+ else if (!strcmp(arg, "--no-textconv"))
+ DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
else if (!strcmp(arg, "--ignore-submodules"))
DIFF_OPT_SET(options, IGNORE_SUBMODULES);