[PATCH] git-cvsimport-script: parse multidigit revisions.
[git.git] / apply.c
diff --git a/apply.c b/apply.c
index 31f134c..97b2eff 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -724,8 +724,8 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
        return offset + hdrsize + patchsize;
 }
 
-const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
-const char minuses[]= "----------------------------------------------------------------------";
+static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
+static const char minuses[]= "----------------------------------------------------------------------";
 
 static void show_stats(struct patch *patch)
 {
@@ -860,7 +860,6 @@ static int find_offset(const char *buf, unsigned long size, const char *fragment
                n = (i >> 1)+1;
                if (i & 1)
                        n = -n;
-               fprintf(stderr, "Fragment applied at offset %d\n", n);
                return try;
        }
 
@@ -1144,7 +1143,7 @@ static void show_rename_copy(struct patch *p)
         */
        if (old != p->old_name)
                printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
-                      old - p->old_name, p->old_name,
+                      (int)(old - p->old_name), p->old_name,
                       old, new, p->score);
        else
                printf(" %s %s => %s (%d%%)\n", renamecopy,
@@ -1238,7 +1237,7 @@ static void create_subdirectories(const char *path)
                len = slash - path;
                memcpy(buf, path, len);
                buf[len] = 0;
-               if (mkdir(buf, 0755) < 0) {
+               if (mkdir(buf, 0777) < 0) {
                        if (errno != EEXIST)
                                break;
                }
@@ -1434,6 +1433,10 @@ int main(int argc, char **argv)
                        check_index = 1;
                        continue;
                }
+               if (!strcmp(arg, "--apply")) {
+                       apply = 1;
+                       continue;
+               }
                if (!strcmp(arg, "--show-files")) {
                        show_files = 1;
                        continue;