threads / patch / 11359

patchmake 'git describe --all --contains' work

Subject: [PATCH] make 'git describe --all --contains' work

## tl;dr

One message between Dec 19, 2007 and Dec 19, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Nicolas Pitre· Dec 19, 2007, 17:53 UTC · lore
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
Show changes to builtin-describe.c +8 −6
diff --git a/builtin-describe.c b/builtin-describe.c
index 6eeb9b5..7a148a2 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -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) {

← back to recent threads