git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] archive: define MAX_ARGS where it's needed

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Jul 25, 2008, 10:41 UTC
Message-ID
<1216982486-5887-3-git-send-email-rene.scharfe@lsrfire.ath.cx>
In-Reply-To
<1216982486-5887-2-git-send-email-rene.scharfe@lsrfire.ath.cx>

MAX_EXTRA_ARGS is not used anymore, so remove it. MAX_ARGS is used only in builtin-upload-archive.c, so define it there. Also report the actual value we're comparing against when the number of args is too big.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 archive.h                |    3 ---
 builtin-upload-archive.c |    3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/archive.h b/archive.h
index f6ceaeb..929368d 100644
--- a/archive.h
+++ b/archive.h
@@ -1,9 +1,6 @@
 #ifndef ARCHIVE_H
 #define ARCHIVE_H
 
-#define MAX_EXTRA_ARGS	32
-#define MAX_ARGS	(MAX_EXTRA_ARGS + 32)
-
 struct archiver_args {
 	const char *base;
 	size_t baselen;
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index cc37b36..a9b02fa 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -16,6 +16,7 @@ static const char deadchild[] =
 static const char lostchild[] =
 "git upload-archive: archiver process was lost";
 
+#define MAX_ARGS (64)
 
 static int run_upload_archive(int argc, const char **argv, const char *prefix)
 {
@@ -45,7 +46,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
 		if (len == 0)
 			break;	/* got a flush */
 		if (sent_argc > MAX_ARGS - 2)
-			die("Too many options (>29)");
+			die("Too many options (>%d)", MAX_ARGS - 2);
 
 		if (p[len-1] == '\n') {
 			p[--len] = 0;
-- 
1.6.0.rc0.42.g186458
Previous: Rene ScharfeNext: Rene Scharfe
Message 3 of 10 in “archive: add write_archive()”
  1. 1/6 archive: add write_archive()Rene Scharfe, Jul 25, 2008
  2. 2/6 archive: move parameter parsing code to archive.cRene Scharfe, Jul 25, 2008
  3. 3/6 archive: define MAX_ARGS where it's neededRene Scharfe, Jul 25, 2008
  4. 4/6 archive: declare struct archiver where it's neededRene Scharfe, Jul 25, 2008
  5. 5/6 archive: allow --exec and --remote without equal signRene Scharfe, Jul 25, 2008
  6. 5/6 archive: allow --exec and --remote without equal signRene Scharfe, Jul 25, 2008
  7. René ScharfeJul 25, 2008
  8. Junio C HamanoJul 26, 2008
  9. René ScharfeJul 26, 2008
  10. Junio C HamanoJul 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.