[PATCH (Eek!)] git diff does not honor --no-ext-diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello list,

git-diff does not honor the --no-ext-diff option in both cases when the external
diff program is set via diff.external and gitattributes.

Is this intentional? If not the following patch seems to fix it.

I think there must be a cleaner way of fixing this than doing it by
`hand' hence the Eek!

Nazri.

 builtin-diff.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/builtin-diff.c b/builtin-diff.c
index 7ceceeb..4ac7e15 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -290,6 +290,19 @@ int cmd_diff(int argc, const char **argv, const
char *prefix)
        /* Otherwise, we are doing the usual "git" diff */
        rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;

+       DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
+       /*
+        * Do we have --no-ext-diff and have external diff setup via either
+        * gitconfig or gitattributes, then clear ALLOW_EXTERNAL by hand.  Eek.
+        */
+       for (i = 1; i < argc; i++) {
+               const char *arg = argv[i];
+               if (!strcmp(arg, "--"))
+                       break;
+               else if (!strcmp(arg, "--no-ext-diff"))
+                       DIFF_OPT_CLR(&rev.diffopt, ALLOW_EXTERNAL);
+       }
+
        if (nongit)
                die("Not a git repository");
        argc = setup_revisions(argc, argv, &rev, NULL);
@@ -298,7 +311,6 @@ int cmd_diff(int argc, const char **argv, const
char *prefix)
                if (diff_setup_done(&rev.diffopt) < 0)
                        die("diff_setup_done failed");
        }
-       DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
        DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
        DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux