git-format-patch: Make the second and subsequent mails replies to the first
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 102735af6c0cfb496a04593ba466a9fbb18f693d..ee5a0e86a71119b5ac11c351a982e31c87649a15 100644 (file)
--- a/git.c
+++ b/git.c
@@ -133,13 +133,12 @@ static int handle_alias(int *argcp, const char ***argv)
                                fflush(stderr);
                        }
 
+                       new_argv = realloc(new_argv, sizeof(char*) *
+                                          (count + *argcp + 1));
                        /* insert after command name */
-                       if (*argcp > 1) {
-                               new_argv = realloc(new_argv, sizeof(char*) *
-                                                  (count + *argcp));
-                               memcpy(new_argv + count, *argv + 1,
-                                      sizeof(char*) * *argcp);
-                       }
+                       memcpy(new_argv + count, *argv + 1,
+                              sizeof(char*) * *argcp);
+                       new_argv[count+*argcp] = NULL;
 
                        *argv = new_argv;
                        *argcp += count - 1;