From: Junio C Hamano <gitster@pobox.com>
Date: Fri, 30 Mar 2018 19:42:08 +0000 (-0700)
Subject: Merge branch 'sb/packfiles-in-repository' into next
X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/caa68db14

Merge branch 'sb/packfiles-in-repository' into next

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

caa68db14db9f582fb6802d6d3c880bb7760ad52
diff --cc bulk-checkin.c
index e5ce2a7954,eadc2d5172..de1f4040c7
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@@ -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 fetch-pack.c
index 373dc90bbe,eac5928a27..216d1368be
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@@ -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 sha1_file.c
index aab3b58e03,314ff55b47..77ccaab928
--- a/sha1_file.c
+++ b/sha1_file.c
@@@ -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 &&