summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 302ebfe)
raw | patch | inline | side by side (parent: 302ebfe)
author | Lukas Sandström <lukass@etek.chalmers.se> | |
Fri, 18 Nov 2005 22:17:50 +0000 (23:17 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 22 Nov 2005 20:38:16 +0000 (12:38 -0800) |
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
pack-redundant.c | patch | blob | history |
diff --git a/pack-redundant.c b/pack-redundant.c
index 15193854e5ca233f9fc7c31cb9362b055fdec0c0..9851c297279287fbc84a8abd2865775644b1315e 100644 (file)
--- a/pack-redundant.c
+++ b/pack-redundant.c
{
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];
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) {
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;
}