git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <junkio@cox.net>, Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] git-archive: make compression level of ZIP archives configurable
Date: Sat, 09 Sep 2006 17:02:38 +0200	[thread overview]
Message-ID: <4502D78E.3050006@lsrfire.ath.cx> (raw)

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;
+}

                 reply	other threads:[~2006-09-09 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4502D78E.3050006@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=vagabon.xyz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).