Code

git-svn: Don't prompt for client cert password everytime.
[git.git] / convert.c
index 4df75595b1f3e689a9685039c372ffb4c8688291..552707e8e65997ebfc2120887783c4fc5698e19f 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -17,8 +17,8 @@
 #define CRLF_INPUT     2
 
 struct text_stat {
-       /* CR, LF and CRLF counts */
-       unsigned cr, lf, crlf;
+       /* NUL, CR, LF and CRLF counts */
+       unsigned nul, cr, lf, crlf;
 
        /* These are just approximations! */
        unsigned printable, nonprintable;
@@ -51,6 +51,9 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
                        case '\b': case '\t': case '\033': case '\014':
                                stats->printable++;
                                break;
+                       case 0:
+                               stats->nul++;
+                               /* fall through */
                        default:
                                stats->nonprintable++;
                        }
@@ -66,6 +69,8 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat *
 static int is_binary(unsigned long size, struct text_stat *stats)
 {
 
+       if (stats->nul)
+               return 1;
        if ((stats->printable >> 7) < stats->nonprintable)
                return 1;
        /*
@@ -321,14 +326,14 @@ static int read_convert_config(const char *var, const char *value)
 
        if (!strcmp("smudge", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                drv->smudge = strdup(value);
                return 0;
        }
 
        if (!strcmp("clean", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                drv->clean = strdup(value);
                return 0;
        }