From: "Lukas Sandström" <lukass@etek.chalmers.se>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <junkio@cox.net>,
"Lukas Sandström" <lukass@etek.chalmers.se>
Subject: [PATCH] Make git-pack-redundant take a list of unimportant objs on stdin
Date: Fri, 18 Nov 2005 23:17:50 +0100 [thread overview]
Message-ID: <437E530E.1020803@etek.chalmers.se> (raw)
This lets us do "git-fsck-objects --full --unreachable | cut -d ' ' -f3 |
git-pack-redundant --all", which will keep git-pack-redundant from keeping
packs just because they contain unreachable objects.
Also add some more --verbose output.
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
---
pack-redundant.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
applies-to: 3771756c044fa4338acc9f6acac3971f2309cc7c
4173f0c77793b13ad50d9c1a1ff5da32fec5e573
diff --git a/pack-redundant.c b/pack-redundant.c
index fb6cb48..f3097a1 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -579,6 +579,8 @@ int main(int argc, char **argv)
{
int i;
struct pack_list *min, *red, *pl;
+ struct llist *ignore;
+ char *sha1, buf[42]; /* 40 byte sha1 + \n + \0 */
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
@@ -621,6 +623,23 @@ int main(int argc, char **argv)
if (alt_odb)
scan_alt_odb_packs();
+ /* ignore objects given on stdin */
+ llist_init(&ignore);
+ if (!isatty(0)) {
+ while (fgets(buf, sizeof(buf), stdin)) {
+ sha1 = xmalloc(20);
+ if (get_sha1_hex(buf, sha1))
+ die("Bad sha1 on stdin: %s", buf);
+ llist_insert_sorted_unique(ignore, sha1, NULL);
+ }
+ }
+ llist_sorted_difference_inplace(all_objects, ignore);
+ pl = local_packs;
+ while (pl) {
+ llist_sorted_difference_inplace(pl->unique_objects, ignore);
+ pl = pl->next;
+ }
+
minimize(&min);
if (verbose) {
@@ -647,6 +666,8 @@ int main(int argc, char **argv)
pl->pack->pack_name);
pl = pl->next;
}
+ if (verbose)
+ fprintf(stderr, "%luMB of redundant packs in total.\n", pack_set_bytecount(red)/(1024*1024));
return 0;
}
---
0.99.9.GIT
next reply other threads:[~2005-11-18 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-18 22:17 Lukas Sandström [this message]
2005-11-18 22:20 ` [PATCH] Document the "ignore objects" feature of git-pack-redundant Lukas Sandström
2005-11-21 11:45 ` [PATCH] Make git-pack-redundant take a list of unimportant objs on stdin Lukas Sandström
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=437E530E.1020803@etek.chalmers.se \
--to=lukass@etek.chalmers.se \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.