mailsplit: fix for more than one input files
authorJunio C Hamano <junkio@cox.net>
Mon, 28 May 2007 22:48:07 +0000 (15:48 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 29 May 2007 07:27:06 +0000 (00:27 -0700)
Earlier commit d63bd9a broke the case where more than one input
files are fed to mailsplit by not incrementing the base counter
when splitting second and subsequent input files.  This should
fix it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-mailsplit.c

index 97ae004ab7939f565733e463a2b53afd63eff9df..c9384255551f316f2416ce49372b820a6d8e3632 100644 (file)
@@ -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);