Merge branch 'cc/multi-promisor'
authorJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2019 18:50:09 +0000 (11:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2019 18:50:09 +0000 (11:50 -0700)
Teach the lazy clone machinery that there can be more than one
promisor remote and consult them in order when downloading missing
objects on demand.

* cc/multi-promisor:
Move core_partial_clone_filter_default to promisor-remote.c
Move repository_format_partial_clone to promisor-remote.c
Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}
remote: add promisor and partial clone config to the doc
partial-clone: add multiple remotes in the doc
t0410: test fetching from many promisor remotes
builtin/fetch: remove unique promisor remote limitation
promisor-remote: parse remote.*.partialclonefilter
Use promisor_remote_get_direct() and has_promisor_remote()
promisor-remote: use repository_format_partial_clone
promisor-remote: add promisor_remote_reinit()
promisor-remote: implement promisor_remote_get_direct()
Add initial support for many promisor remotes
fetch-object: make functions return an error code
t0410: remove pipes after git commands

16 files changed:
1  2 
Makefile
builtin/cat-file.c
builtin/fetch.c
builtin/gc.c
builtin/repack.c
cache-tree.c
cache.h
config.c
connected.c
diff.c
packfile.c
sha1-file.c
t/t0410-partial-clone.sh
t/t5601-clone.sh
t/t5616-partial-clone.sh
unpack-trees.c
diff --cc Makefile
Simple merge
Simple merge
diff --cc builtin/fetch.c
index 54d6b018929159f7eb1649dbaf33eb1b7f251140,5657d054ec55f71cbf8f117e93516f6193cb4bf3..538f0e72073fdc92af1b0d79604856cf80a045f6
  #include "packfile.h"
  #include "list-objects-filter-options.h"
  #include "commit-reach.h"
 +#include "branch.h"
+ #include "promisor-remote.h"
  
 +#define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
 +
  static const char * const builtin_fetch_usage[] = {
        N_("git fetch [<options>] [<repository> [<refspec>...]]"),
        N_("git fetch [<options>] <group>"),
diff --cc builtin/gc.c
Simple merge
index 632c0c0a79422a229d52c83665331501e8c54e29,df9a32c9060e46d9e33d2f1aa7599e63a01763aa..3b3dd1437299a53a9031572820c12f3269922695
@@@ -361,12 -370,10 +362,12 @@@ int cmd_repack(int argc, const char **a
        argv_array_push(&cmd.args, "--all");
        argv_array_push(&cmd.args, "--reflog");
        argv_array_push(&cmd.args, "--indexed-objects");
-       if (repository_format_partial_clone)
+       if (has_promisor_remote())
                argv_array_push(&cmd.args, "--exclude-promisor-objects");
 -      if (write_bitmaps)
 +      if (write_bitmaps > 0)
                argv_array_push(&cmd.args, "--write-bitmap-index");
 +      else if (write_bitmaps < 0)
 +              argv_array_push(&cmd.args, "--write-bitmap-index-quiet");
        if (use_delta_islands)
                argv_array_push(&cmd.args, "--delta-islands");
  
diff --cc cache-tree.c
index c22161f987152ea18715b00815e987847786c5ff,64c285a746a886bc53bcc3ee0b1713ad2b50b3fc..0e5724fad752e9157dbcf1caba0438b42386ee3d
@@@ -5,9 -5,10 +5,10 @@@
  #include "cache-tree.h"
  #include "object-store.h"
  #include "replace-object.h"
+ #include "promisor-remote.h"
  
 -#ifndef DEBUG
 -#define DEBUG 0
 +#ifndef DEBUG_CACHE_TREE
 +#define DEBUG_CACHE_TREE 0
  #endif
  
  struct cache_tree *cache_tree(void)
diff --cc cache.h
Simple merge
diff --cc config.c
Simple merge
diff --cc connected.c
Simple merge
diff --cc diff.c
Simple merge
diff --cc packfile.c
index d98ac2287683f971a448b931262ef3d459e145d4,50aaf93bc36cc43999de4f7785a6a9c54eafbf37..1a7d69fe32a8808dd34063c48daf61e32886b47a
@@@ -16,7 -16,7 +16,8 @@@
  #include "tree.h"
  #include "object-store.h"
  #include "midx.h"
 +#include "commit-graph.h"
+ #include "promisor-remote.h"
  
  char *odb_pack_name(struct strbuf *buf,
                    const unsigned char *sha1,
diff --cc sha1-file.c
Simple merge
index 33e0aa4a896575f14442e5b1a9029640d4d7ac50,2498e72a3412da9bc22f27e33df7d2380e62ad5e..d4b7e535ea134569ed8bf5643edf8d435a22bc1a
@@@ -514,11 -562,9 +562,12 @@@ test_expect_success 'fetching of missin
        # associated packfile contains the object
        ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
        test_line_count = 1 promisorlist &&
-       IDX=$(cat promisorlist | sed "s/promisor$/idx/") &&
-       git verify-pack --verbose "$IDX" | grep "$HASH"
+       IDX=$(sed "s/promisor$/idx/" promisorlist) &&
+       git verify-pack --verbose "$IDX" >out &&
+       grep "$HASH" out
  '
  
 +# DO NOT add non-httpd-specific tests here, because the last part of this
 +# test script is only executed when httpd is available and enabled.
 +
  test_done
Simple merge
Simple merge
diff --cc unpack-trees.c
Simple merge