@matheusbsbs / matheus-bagliano / commits / d8498500ba
Fork 0

fix git alias

When extra command line arguments are given to a command that was alias-expanded, the code generated a wrong argument list, leaving the original alias in the result, and forgetting to terminate the new argv list. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jun 14, 2006 at 06:01 UTC d8498500ba5cf348577202e0bb7810cbd68fa120
1 file changed +3 -3
git.c
+3 -3
@@ -122,9 +122,9 @@ static int handle_alias(int *argcp, const char ***argv)
122 /* insert after command name */
123 if (*argcp > 1) {
124 new_argv = realloc(new_argv, sizeof(char*) *
125 - (count + *argcp - 1));
126 - memcpy(new_argv + count, *argv, sizeof(char*) *
127 - (*argcp - 1));
125 + (count + *argcp));
126 + memcpy(new_argv + count, *argv + 1,
127 + sizeof(char*) * *argcp);
128 }
129
130 *argv = new_argv;