Merge branch 'sb/packfiles-in-repository' into next
authorJunio C Hamano <gitster@pobox.com>
Fri, 30 Mar 2018 19:42:08 +0000 (12:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Mar 2018 19:42:08 +0000 (12:42 -0700)
Refactoring of the internal global data structure continues.

* sb/packfiles-in-repository:
packfile: keep prepare_packed_git() private
packfile: allow find_pack_entry to handle arbitrary repositories
packfile: add repository argument to find_pack_entry
packfile: allow reprepare_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git_one to handle arbitrary repositories
packfile: add repository argument to reprepare_packed_git
packfile: add repository argument to prepare_packed_git
packfile: add repository argument to prepare_packed_git_one
packfile: allow install_packed_git to handle arbitrary repositories
packfile: allow rearrange_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git_mru to handle arbitrary repositories

14 files changed:
1  2 
builtin/fsck.c
builtin/gc.c
builtin/pack-objects.c
builtin/pack-redundant.c
builtin/receive-pack.c
bulk-checkin.c
fast-import.c
fetch-pack.c
http-backend.c
http.c
packfile.c
packfile.h
sha1_file.c
sha1_name.c
diff --cc builtin/fsck.c
Simple merge
diff --cc builtin/gc.c
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc bulk-checkin.c
index e5ce2a795433b5d369cf5a03aaa7d35694ae81fd,eadc2d5172052878c2b9276313cef752baedd839..de1f4040c788f683a0cca3695c10b163811dd945
@@@ -57,10 -58,10 +58,10 @@@ clear_exit
  
        strbuf_release(&packname);
        /* Make objects we just wrote available to ourselves */
-       reprepare_packed_git();
+       reprepare_packed_git(the_repository);
  }
  
 -static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])
 +static int already_written(struct bulk_checkin_state *state, struct object_id *oid)
  {
        int i;
  
diff --cc fast-import.c
Simple merge
diff --cc fetch-pack.c
index 373dc90bbec365384bbd02fcd4573744cef30634,eac5928a27bd63f0b27176f3a50af283661c3dfa..216d1368beffbba7364b9d8c014ddf144595c8c1
@@@ -1561,13 -1191,9 +1562,13 @@@ struct ref *fetch_pack(struct fetch_pac
                die(_("no matching remote head"));
        }
        prepare_shallow_info(&si, shallow);
 -      ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
 -                              &si, pack_lockfile);
 +      if (version == protocol_v2)
 +              ref_cpy = do_fetch_pack_v2(args, fd, ref, sought, nr_sought,
 +                                         pack_lockfile);
 +      else
 +              ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
 +                                      &si, pack_lockfile);
-       reprepare_packed_git();
+       reprepare_packed_git(the_repository);
        update_shallow(args, sought, nr_sought, &si);
        clear_shallow_info(&si);
        return ref_cpy;
diff --cc http-backend.c
Simple merge
diff --cc http.c
Simple merge
diff --cc packfile.c
Simple merge
diff --cc packfile.h
Simple merge
diff --cc sha1_file.c
index aab3b58e0330531efa8a442eafb18840b1f212f3,314ff55b4769a4262a76e3fa4c639f7d9c9f4b88..77ccaab928529d37aa971168c54e31358e12ef8e
@@@ -1268,22 -1266,17 +1268,22 @@@ int oid_object_info_extended(const stru
        }
  
        while (1) {
-               if (find_pack_entry(real->hash, &e))
 -              if (find_pack_entry(the_repository, real, &e))
++              if (find_pack_entry(the_repository, real->hash, &e))
                        break;
  
 +              if (flags & OBJECT_INFO_IGNORE_LOOSE)
 +                      return -1;
 +
                /* Most likely it's a loose object. */
 -              if (!sha1_loose_object_info(the_repository, real, oi, flags))
 +              if (!sha1_loose_object_info(the_repository, real->hash, oi, flags))
                        return 0;
  
                /* Not a loose object; someone else may have just packed it. */
 -              reprepare_packed_git(the_repository);
 -              if (find_pack_entry(the_repository, real, &e))
 -                      break;
 +              if (!(flags & OBJECT_INFO_QUICK)) {
-                       reprepare_packed_git();
-                       if (find_pack_entry(real->hash, &e))
++                      reprepare_packed_git(the_repository);
++                      if (find_pack_entry(the_repository, real->hash, &e))
 +                              break;
 +              }
  
                /* Check if it is a missing object */
                if (fetch_if_missing && repository_format_partial_clone &&
diff --cc sha1_name.c
Simple merge