git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <stefanbeller@googlemail.com>
To: pclouds@gmail.com, git@vger.kernel.org
Cc: Stefan Beller <stefanbeller@googlemail.com>
Subject: [PATCH] repack: Add --version parameter
Date: Thu, 26 Sep 2013 10:32:29 +0200	[thread overview]
Message-ID: <1380184349-26380-1-git-send-email-stefanbeller@googlemail.com> (raw)
In-Reply-To: <1380162409-18224-10-git-send-email-pclouds@gmail.com>

This is just a direct translation of
http://article.gmane.org/gmane.comp.version-control.git/235396
So I don't consider this is ready for inclusion.

Some notes:
We need to have more error checking, repack shall be 0, 2 or 4 but nothing
else. If 0 is given, no argument is passed to pack-objects, in case of
2 or 4 --version=<n> is passed.

Do we really want to call it "--version"? This parameter sounds so much
like questioning for the program version, similar to
	git --version
	1.8.4
So I'd rather use "--repack-version".
---
 builtin/repack.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/builtin/repack.c b/builtin/repack.c
index 3e56614..fd05e9a 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -9,6 +9,7 @@
 #include "argv-array.h"
 
 static int delta_base_offset = 1;
+static int pack_version;
 static char *packdir, *packtmp;
 
 static const char *const git_repack_usage[] = {
@@ -22,6 +23,9 @@ static int repack_config(const char *var, const char *value, void *cb)
 		delta_base_offset = git_config_bool(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "core.preferredPackVersion")) {
+		pack_version = git_config_int(var, value);
+	}
 	return git_default_config(var, value, cb);
 }
 
@@ -165,6 +169,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 				N_("limits the maximum delta depth")),
 		OPT_INTEGER(0, "max-pack-size", &max_pack_size,
 				N_("maximum size of each packfile")),
+		OPT_INTEGER(0, "pack-version", &pack_version,
+				N_("format version of the output pack")),
 		OPT_END()
 	};
 
@@ -220,6 +226,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 		argv_array_push(&cmd_args,  "--quiet");
 	if (delta_base_offset)
 		argv_array_push(&cmd_args,  "--delta-base-offset");
+	if (pack_version)
+		argv_array_pushf(&cmd_args, "--version=%u", pack_version);
 
 	argv_array_push(&cmd_args, packtmp);
 
-- 
1.8.4.474.g128a96c

  reply	other threads:[~2013-09-26  8:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26  2:26 [PATCH 00/10] pack v4 UI support Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 01/10] test-dump: new test program to examine binary data Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 02/10] config: add core.preferredPackVersion Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 03/10] upload-pack: new capability to send pack v4 Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 04/10] fetch: new option to set preferred pack version for transfer Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 05/10] clone: " Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 06/10] fetch: pack v4 support on smart http Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 07/10] receive-pack: request for packv4 if it's the preferred version Nguyễn Thái Ngọc Duy
2013-10-17 17:26   ` Junio C Hamano
2013-09-26  2:26 ` [PATCH 08/10] send-pack: support pack v4 Nguyễn Thái Ngọc Duy
2013-09-26  2:26 ` [PATCH 09/10] repack: add --pack-version and fall back to core.preferredPackVersion Nguyễn Thái Ngọc Duy
2013-09-26  8:32   ` Stefan Beller [this message]
2013-09-26 10:17     ` [PATCH] repack: Add --version parameter Felipe Contreras
2013-09-28  8:53       ` Stefan Beller
2013-09-26 11:42     ` Duy Nguyen
2013-09-28  8:54       ` Stefan Beller
2013-09-26  2:26 ` [PATCH 10/10] count-objects: report pack v4 usage Nguyễn Thái Ngọc Duy
2013-09-26  4:51 ` [PATCH 00/10] pack v4 UI support Nicolas Pitre
2013-09-26  5:09   ` Duy Nguyen
2013-09-27  2:59     ` Nicolas Pitre

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=1380184349-26380-1-git-send-email-stefanbeller@googlemail.com \
    --to=stefanbeller@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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).