Merge branch 'sf/diff'
authorJunio C Hamano <junkio@cox.net>
Sun, 9 Jul 2006 07:52:36 +0000 (00:52 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 9 Jul 2006 07:52:36 +0000 (00:52 -0700)
1  2 
diff.c
diff --combined diff.c
index aab246c97eb1660acfa231f7008180a12f6deb8d,b423491f60e7c0dc397e9db9a6864cd3903e2f28..3e26180f08204df2e7519e4613aa6e3e844e21b2
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -110,14 -110,8 +110,14 @@@ int git_diff_config(const char *var, co
        if (!strcmp(var, "diff.color")) {
                if (!value)
                        diff_use_color_default = 1; /* bool */
 -              else if (!strcasecmp(value, "auto"))
 -                      diff_use_color_default = isatty(1);
 +              else if (!strcasecmp(value, "auto")) {
 +                      diff_use_color_default = 0;
 +                      if (isatty(1)) {
 +                              char *term = getenv("TERM");
 +                              if (term && strcmp(term, "dumb"))
 +                                      diff_use_color_default = 1;
 +                      }
 +              }
                else if (!strcasecmp(value, "never"))
                        diff_use_color_default = 0;
                else if (!strcasecmp(value, "always"))
@@@ -729,7 -723,7 +729,7 @@@ static void builtin_diff(const char *na
        if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
                die("unable to read files to diff");
  
-       if (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2)) {
+       if (!o->text && (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2))) {
                /* Quite common confusing case */
                if (mf1.size == mf2.size &&
                    !memcmp(mf1.ptr, mf2.ptr, mf1.size))
@@@ -1567,6 -1561,9 +1567,9 @@@ int diff_opt_parse(struct diff_options 
                options->output_format |= DIFF_FORMAT_PATCH;
                options->full_index = options->binary = 1;
        }
+       else if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) {
+               options->text = 1;
+       }
        else if (!strcmp(arg, "--name-only"))
                options->output_format |= DIFF_FORMAT_NAME;
        else if (!strcmp(arg, "--name-status"))