Make git-pack-redundant take a list of unimportant objs on stdin
PATCH 1/1 Make git-pack-redundant take a list of unimportant objs on stdin
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.
---
pack-redundant.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
applies-to: 3771756c044fa4338acc9f6acac3971f2309cc7c 4173f0c77793b13ad50d9c1a1ff5da32fec5e573
pack-redundant.c +21 -0
@@ -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
PATCH 1/1 Document the "ignore objects" feature of git-pack-redundant
---
Documentation/git-pack-redundant.txt | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
applies-to: 5053091ee7d1f4b32b18a21f4b255cf1141cf72c e417344dab21aca41fbc1f99d935ef033e53e3a8
Documentation/git-pack-redundant.txt +8 -0
@@ -16,6 +16,14 @@ This program computes which packs in you are redundant. The output is suitable for piping to 'xargs rm' if you are in the root of the repository. +git-pack-redundant accepts a list of objects on standard input. Any objects +given will be ignored when checking which packs are required. This makes the +following command useful when wanting to remove packs which contain unreachable +objects. + +git-fsck-objects --full --unreachable | cut -d ' ' -f3 | \ +git-pack-redundant --all | xargs rm + OPTIONS -------
---
0.99.9.GIT
Quoted 8 lines · Lukas Sandström
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 <[email protected]>
The patch which documents this feature was committed (9a888b758f48d88d1e83c9765e33d4452710d5a5), but not the feature. Did you just miss the patch, or is there something wrong with it?
/Lukas