From: "Dana How" <danahow@gmail.com>
To: "Junio C Hamano" <junkio@cox.net>
Cc: git@vger.kernel.org, danahow@gmail.com
Subject: [PATCH 13/13] recognize new options in git-{repack,pack-objects}
Date: Thu, 5 Apr 2007 15:42:31 -0700 [thread overview]
Message-ID: <56b7f5510704051542o49cead12rbc318352462a6783@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
---
builtin-pack-objects.c | 41 +++++++++++++++++++++++++++++++++++++++--
git-repack.sh | 12 ++++++++----
2 files changed, 47 insertions(+), 6 deletions(-)
--
Dana L. How danahow@gmail.com +1 650 804 5991 cell
[-- Attachment #2: 0013-recognize-new-options-in-git-repack-pack-objects.patch.txt --]
[-- Type: text/plain, Size: 3819 bytes --]
From a6a243c54f9bf1d663747827f9d3b36cbc6a5aee Mon Sep 17 00:00:00 2001
From: Dana How <how@deathvalley.cswitch.com>
Date: Thu, 5 Apr 2007 15:06:34 -0700
Subject: [PATCH 13/13] recognize new options in git-{repack,pack-objects}
---
builtin-pack-objects.c | 41 +++++++++++++++++++++++++++++++++++++++--
git-repack.sh | 12 ++++++++----
2 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 3229df8..928ad30 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -14,8 +14,8 @@
#include "list-objects.h"
static const char pack_usage[] = "\
-git-pack-objects [{ -q | --progress | --all-progress }] \n\
- [--local] [--incremental] [--window=N] [--depth=N] \n\
+git-pack-objects [{ -q | --progress | --all-progress }] [--pack-limit[=N]]\n\
+ [--blob-limit=N] [--local] [--incremental] [--window=N] [--depth=N]\n\
[--no-reuse-delta] [--delta-base-offset] [--non-empty] \n\
[--revs [--unpacked | --all]*] [--reflog] [--stdout | base-name] \n\
[<ref-list | <object-list]";
@@ -1686,6 +1686,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
const char **rp_av;
int rp_ac_alloc = 64;
int rp_ac;
+ int added = 0;
rp_av = xcalloc(rp_ac_alloc, sizeof(*rp_av));
@@ -1714,6 +1715,24 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
incremental = 1;
continue;
}
+ if (!strcmp("--pack-limit", arg)) {
+ offset_limit = 1UL << 31;
+ continue;
+ }
+ if (!prefixcmp(arg, "--pack-limit=")) {
+ char *end;
+ offset_limit = strtoul(arg+13, &end, 0);
+ if (!arg[13] || *end)
+ usage(pack_usage);
+ continue;
+ }
+ if (!prefixcmp(arg, "--blob-limit=")) {
+ char *end;
+ blob_limit = strtoul(arg+13, &end, 0);
+ if (!arg[13] || *end)
+ usage(pack_usage);
+ continue;
+ }
if (!prefixcmp(arg, "--window=")) {
char *end;
window = strtoul(arg+9, &end, 0);
@@ -1777,6 +1796,24 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
}
usage(pack_usage);
}
+ if ( offset_limit && !blob_limit && !pack_to_stdout ) {
+ /* need to limit blob size when creating bounded packs on disk */
+ blob_limit = offset_limit >> 2;
+ added |= 2;
+ }
+ if ( offset_limit && !no_reuse_delta ) {
+ /* didn't audit this case yet */
+ no_reuse_delta = 1;
+ added |= 1;
+ }
+ if ( added ) {
+ fprintf(stderr, "Added to command line:");
+ if ( added & 1 )
+ fprintf(stderr, " --no-reuse-delta");
+ if ( added & 2 )
+ fprintf(stderr, " --blob-limit=%u", blob_limit);
+ fprintf(stderr, "\n");
+ }
/* Traditionally "pack-objects [options] base extra" failed;
* we would however want to take refs parameter that would
diff --git a/git-repack.sh b/git-repack.sh
index ddfa8b4..0299ff1 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -18,6 +18,9 @@ do
-q) quiet=-q ;;
-f) no_reuse_delta=--no-reuse-delta ;;
-l) local=--local ;;
+ --pack-limit) extra="$extra $1" ;;
+ --pack-limit=*) extra="$extra $1" ;;
+ --blob-limit=*) extra="$extra $1" ;;
--window=*) extra="$extra $1" ;;
--depth=*) extra="$extra $1" ;;
*) usage ;;
@@ -62,11 +65,12 @@ case ",$all_into_one," in
esac
args="$args $local $quiet $no_reuse_delta$extra"
-name=$(git-pack-objects --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
+names=$(git-pack-objects --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
exit 1
-if [ -z "$name" ]; then
+if [ -z "$names" ]; then
echo Nothing new to pack.
-else
+fi
+for name in $names ; do
chmod a-w "$PACKTMP-$name.pack"
chmod a-w "$PACKTMP-$name.idx"
if test "$quiet" != '-q'; then
@@ -92,7 +96,7 @@ else
exit 1
}
rm -f "$PACKDIR/old-pack-$name.pack" "$PACKDIR/old-pack-$name.idx"
-fi
+done
if test "$remove_redundant" = t
then
--
1.5.1.rc2.18.g9c88-dirty
reply other threads:[~2007-04-05 22:42 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=56b7f5510704051542o49cead12rbc318352462a6783@mail.gmail.com \
--to=danahow@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).