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
+++ 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
@@@ -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
+++ 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
@@@ -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
+++ 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
@@@ -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