Code

make 'git describe --all --contains' work
authorNicolas Pitre <nico@cam.org>
Wed, 19 Dec 2007 17:53:16 +0000 (12:53 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Dec 2007 22:59:19 +0000 (14:59 -0800)
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-describe.c

index 6eeb9b50456da53e396136c11904bbdc3d36a921..7a148a2c26591d82e6057d610182445eae5fe171 100644 (file)
@@ -267,12 +267,14 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 
        if (contains) {
                const char **args = xmalloc((4 + argc) * sizeof(char*));
-               args[0] = "name-rev";
-               args[1] = "--name-only";
-               args[2] = "--tags";
-               memcpy(args + 3, argv, argc * sizeof(char*));
-               args[3 + argc] = NULL;
-               return cmd_name_rev(3 + argc, args, prefix);
+               int i = 0;
+               args[i++] = "name-rev";
+               args[i++] = "--name-only";
+               if (!all)
+                       args[i++] = "--tags";
+               memcpy(args + i, argv, argc * sizeof(char*));
+               args[i + argc] = NULL;
+               return cmd_name_rev(i + argc, args, prefix);
        }
 
        if (argc == 0) {