git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
[gitweb.git] / builtin-mailsplit.c
index 97ae004ab7939f565733e463a2b53afd63eff9df..43fc373a15cbe935054b47f9bd67c04ecf216e4e 100644 (file)
@@ -159,8 +159,8 @@ static int split_maildir(const char *maildir, const char *dir,
        return ret;
 }
 
-int split_mbox(const char *file, const char *dir, int allow_bare,
-               int nr_prec, int skip)
+static int split_mbox(const char *file, const char *dir, int allow_bare,
+                     int nr_prec, int skip)
 {
        char name[PATH_MAX];
        int ret = -1;
@@ -261,7 +261,8 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
                                error("cannot split patches from stdin");
                                return 1;
                        }
-                       num += ret;
+                       num += (ret - nr);
+                       nr = ret;
                        continue;
                }
 
@@ -279,7 +280,8 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
                        error("cannot split patches from %s", arg);
                        return 1;
                }
-               num += ret;
+               num += (ret - nr);
+               nr = ret;
        }
 
        printf("%d\n", num);