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

[PATCH] git-archive: make compression level of ZIP archives configurable

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Sep 9, 2006, 15:02 UTC
Message-ID
<4502D78E.3050006@lsrfire.ath.cx>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
diff --git a/archive.h b/archive.h
index f3d344b..d8cca73 100644
--- a/archive.h
+++ b/archive.h
@@ -42,5 +42,6 @@ extern void parse_pathspec_arg(const cha
  */
 extern int write_tar_archive(struct archiver_args *);
 extern int write_zip_archive(struct archiver_args *);
+extern void *parse_extra_zip_args(int argc, const char **argv);
 
 #endif	/* ARCHIVE_H */
diff --git a/builtin-archive.c b/builtin-archive.c
index 6ef2c90..83e5589 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -15,8 +15,15 @@ static const char archive_usage[] =
 "git-archive --format=<fmt> [--prefix=<prefix>/] [<extra>] <tree-ish> [path...]";
 
 struct archiver archivers[] = {
-	{ .name = "tar", .write_archive = write_tar_archive },
-	{ .name = "zip", .write_archive = write_zip_archive },
+	{
+		.name		= "tar",
+		.write_archive	= write_tar_archive,
+	},
+	{
+		.name		= "zip",
+		.write_archive	= write_zip_archive,
+		.parse_extra	= parse_extra_zip_args,
+	},
 };
 
 static int run_remote_archiver(struct archiver *ar, int argc, const char **argv)
diff --git a/builtin-zip-tree.c b/builtin-zip-tree.c
index 23b4de5..fdac2bd 100644
--- a/builtin-zip-tree.c
+++ b/builtin-zip-tree.c
@@ -379,3 +379,16 @@ int write_zip_archive(struct archiver_ar
 
 	return 0;
 }
+
+void *parse_extra_zip_args(int argc, const char **argv)
+{
+	for (; argc > 0; argc--, argv++) {
+		const char *arg = argv[0];
+
+		if (arg[0] == '-' && isdigit(arg[1]) && arg[2] == '\0')
+			zlib_compression_level = arg[1] - '0';
+		else
+			die("Unknown argument for zip format: %s", arg);
+	}
+	return NULL;
+}
Message 1 of 1 in “git-archive: make compression level of ZIP archives configurable”
  1. git-archive: make compression level of ZIP archives configurableRene Scharfe, Sep 9, 2006

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.