Merge branch 'ds/midx-expire-repack'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2019 18:30:19 +0000 (11:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2019 18:30:19 +0000 (11:30 -0700)
"git multi-pack-index" learned expire and repack subcommands.

* ds/midx-expire-repack:
t5319: use 'test-tool path-utils' instead of 'ls -l'
t5319-multi-pack-index.sh: test batch size zero
midx: add test that 'expire' respects .keep files
multi-pack-index: test expire while adding packs
midx: implement midx_repack()
multi-pack-index: prepare 'repack' subcommand
multi-pack-index: implement 'expire' subcommand
midx: refactor permutation logic and pack sorting
midx: simplify computation of pack name lengths
multi-pack-index: prepare for 'expire' subcommand
Docs: rearrange subcommands for multi-pack-index
repack: refactor pack deletion for future use

1  2 
builtin/repack.c
packfile.c
packfile.h
Simple merge
diff --cc packfile.c
index c0d83fdfed973de8574224e46fb0afd4be0a98c9,020e61a3b6b470a71536d9fefa1f2ba1294a4b17..fc43a6c52c75a32548c20bbc4a5aa7d0cc3ddd0d
@@@ -351,10 -350,36 +351,38 @@@ void close_object_store(struct raw_obje
                close_midx(o->multi_pack_index);
                o->multi_pack_index = NULL;
        }
 +
 +      close_commit_graph(o);
  }
  
+ void unlink_pack_path(const char *pack_name, int force_delete)
+ {
+       static const char *exts[] = {".pack", ".idx", ".keep", ".bitmap", ".promisor"};
+       int i;
+       struct strbuf buf = STRBUF_INIT;
+       size_t plen;
+       strbuf_addstr(&buf, pack_name);
+       strip_suffix_mem(buf.buf, &buf.len, ".pack");
+       plen = buf.len;
+       if (!force_delete) {
+               strbuf_addstr(&buf, ".keep");
+               if (!access(buf.buf, F_OK)) {
+                       strbuf_release(&buf);
+                       return;
+               }
+       }
+       for (i = 0; i < ARRAY_SIZE(exts); i++) {
+               strbuf_setlen(&buf, plen);
+               strbuf_addstr(&buf, exts[i]);
+               unlink(buf.buf);
+       }
+       strbuf_release(&buf);
+ }
  /*
   * The LRU pack is the one with the oldest MRU window, preferring packs
   * with no used windows, or the oldest mtime if it has no windows allocated.
diff --cc packfile.h
Simple merge