Merge branch 'jh/fsck-promisors'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)
In preparation for implementing narrow/partial clone, the machinery
for checking object connectivity used by gc and fsck has been
taught that a missing object is OK when it is referenced by a
packfile specially marked as coming from trusted repository that
promises to make them available on-demand and lazily.

* jh/fsck-promisors:
gc: do not repack promisor packfiles
rev-list: support termination at promisor objects
sha1_file: support lazily fetching missing objects
introduce fetch-object: fetch one promisor object
index-pack: refactor writing of .keep files
fsck: support promisor objects as CLI argument
fsck: support referenced promisor objects
fsck: support refs pointing to promisor objects
fsck: introduce partialclone extension
extension.partialclone: introduce partial clone extension

18 files changed:
1  2 
Documentation/rev-list-options.txt
Makefile
builtin/fsck.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/prune.c
builtin/rev-list.c
cache.h
environment.c
fetch-pack.c
list-objects.c
object.c
revision.c
revision.h
setup.c
sha1_file.c
transport.c
transport.h
Simple merge
diff --cc Makefile
index 37e02cec1b614097b418e73f2d07bf7e830ed3c1,795e0c7cb581a66b24b64ed0beec87e408027b74..eb74e6cf3c4b25ee639c192cefcddf8f235ffc0d
+++ b/Makefile
@@@ -802,9 -792,9 +802,10 @@@ LIB_OBJS += ewah/ewah_bitmap.
  LIB_OBJS += ewah/ewah_io.o
  LIB_OBJS += ewah/ewah_rlw.o
  LIB_OBJS += exec_cmd.o
+ LIB_OBJS += fetch-object.o
  LIB_OBJS += fetch-pack.o
  LIB_OBJS += fsck.o
 +LIB_OBJS += fsmonitor.o
  LIB_OBJS += gettext.o
  LIB_OBJS += gpg-interface.o
  LIB_OBJS += graph.o
diff --cc builtin/fsck.c
Simple merge
index 4c51aec81f374d52e7c6a1afa73ab9dea3cf40b8,a0a35e69c0a044fa40a2481c22ef56a766b23e41..5ebd370c56d2611494868ad1cf5957b5e9ea636e
@@@ -1676,8 -1701,14 +1698,10 @@@ int cmd_index_pack(int argc, const cha
                                verify = 1;
                                show_stat = 1;
                                stat_only = 1;
 -                      } else if (!strcmp(arg, "--keep")) {
 -                              keep_msg = "";
 -                      } else if (starts_with(arg, "--keep=")) {
 -                              keep_msg = arg + 7;
 -                      } else if (!strcmp(arg, "--promisor")) {
 -                              promisor_msg = "";
 -                      } else if (starts_with(arg, "--promisor=")) {
 -                              promisor_msg = arg + strlen("--promisor=");
 +                      } else if (skip_to_optional_arg(arg, "--keep", &keep_msg)) {
 +                              ; /* nothing to do */
++                      } else if (skip_to_optional_arg(arg, "--promisor", &promisor_msg)) {
++                              ; /* already parsed */
                        } else if (starts_with(arg, "--threads=")) {
                                char *end;
                                nr_threads = strtoul(arg+10, &end, 0);
Simple merge
diff --cc builtin/prune.c
Simple merge
Simple merge
diff --cc cache.h
index d8b975a5715e8a5ec7c32e176958725cba61d67a,69800721324d7e437e8be78e4ffb54a6271c5755..23413fdcb71f484b6dc59bec2c912d9dd495cf4f
+++ b/cache.h
@@@ -918,8 -865,8 +919,9 @@@ extern char *repository_format_partial_
  struct repository_format {
        int version;
        int precious_objects;
+       char *partial_clone; /* value of extensions.partialclone */
        int is_bare;
 +      int hash_algo;
        char *work_tree;
        struct string_list unknown_extensions;
  };
diff --cc environment.c
Simple merge
diff --cc fetch-pack.c
Simple merge
diff --cc list-objects.c
Simple merge
diff --cc object.c
Simple merge
diff --cc revision.c
Simple merge
diff --cc revision.h
index d7a35c8c9e752cea0ea05ee7e13d696814470a83,5f9a49ca66b5b0e4dfaf0acb862785cf7a2abb5e..3dee97bfb97a4abd636ad7055eb84cf5dea79558
@@@ -122,7 -122,9 +122,10 @@@ struct rev_info 
                        ancestry_path:1,
                        first_parent_only:1,
                        line_level_traverse:1,
-                       tree_blobs_in_commit_order:1;
++                      tree_blobs_in_commit_order:1,
+                       /* for internal use only */
+                       exclude_promisor_objects:1;
  
        /* Diff flags */
        unsigned int    diff:1,
diff --cc setup.c
index 8cc34186ce1f918ce5a9c8fc22ea81b7c645ff17,58536bd6eeb496d455953634b6b1943f69ed80ef..c5d55dcee45ca811def540ca43c1e1eb57532a81
+++ b/setup.c
@@@ -463,11 -466,12 +467,12 @@@ static int check_repository_format_gent
                die("%s", err.buf);
        }
  
 -      repository_format_precious_objects = candidate.precious_objects;
 -      repository_format_partial_clone = candidate.partial_clone;
 -      string_list_clear(&candidate.unknown_extensions, 0);
 +      repository_format_precious_objects = candidate->precious_objects;
++      repository_format_partial_clone = candidate->partial_clone;
 +      string_list_clear(&candidate->unknown_extensions, 0);
        if (!has_common) {
 -              if (candidate.is_bare != -1) {
 -                      is_bare_repository_cfg = candidate.is_bare;
 +              if (candidate->is_bare != -1) {
 +                      is_bare_repository_cfg = candidate->is_bare;
                        if (is_bare_repository_cfg == 1)
                                inside_work_tree = -1;
                }
diff --cc sha1_file.c
index 3da70ac650a8cdeca6ef8a6a424a7740d38267d5,dd956e2bb6a23909554e4ec01d8b683b43a83f1f..2e58f5560a63426ab1b9848434ea0e1ac3ba1fba
@@@ -1221,10 -1155,8 +1224,11 @@@ int sha1_object_info_extended(const uns
        const unsigned char *real = (flags & OBJECT_INFO_LOOKUP_REPLACE) ?
                                    lookup_replace_object(sha1) :
                                    sha1;
+       int already_retried = 0;
  
 +      if (is_null_sha1(real))
 +              return -1;
 +
        if (!oi)
                oi = &blank_oi;
  
diff --cc transport.c
Simple merge
diff --cc transport.h
Simple merge