Merge branch 'sb/object-store'
Refactoring the internal global data structure to make it possible to open multiple repositories, work with and then close them. Rerolled by Duy on top of a separate preliminary clean-up topic. The resulting structure of the topics looked very sensible. * sb/object-store: (27 commits) sha1_file: allow sha1_loose_object_info to handle arbitrary repositories sha1_file: allow map_sha1_file to handle arbitrary repositories sha1_file: allow map_sha1_file_1 to handle arbitrary repositories sha1_file: allow open_sha1_file to handle arbitrary repositories sha1_file: allow stat_sha1_file to handle arbitrary repositories sha1_file: allow sha1_file_name to handle arbitrary repositories sha1_file: add repository argument to sha1_loose_object_info sha1_file: add repository argument to map_sha1_file sha1_file: add repository argument to map_sha1_file_1 sha1_file: add repository argument to open_sha1_file sha1_file: add repository argument to stat_sha1_file sha1_file: add repository argument to sha1_file_name sha1_file: allow prepare_alt_odb to handle arbitrary repositories sha1_file: allow link_alt_odb_entries to handle arbitrary repositories sha1_file: add repository argument to prepare_alt_odb sha1_file: add repository argument to link_alt_odb_entries sha1_file: add repository argument to read_info_alternates sha1_file: add repository argument to link_alt_odb_entry sha1_file: add raw_object_store argument to alt_odb_usable pack: move approximate object count to object store ...
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "builtin.h"
|
||||
#include "cache.h"
|
||||
#include "repository.h"
|
||||
#include "config.h"
|
||||
#include "attr.h"
|
||||
#include "object.h"
|
||||
@ -28,6 +29,7 @@
|
||||
#include "argv-array.h"
|
||||
#include "list.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static const char *pack_usage[] = {
|
||||
N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"),
|
||||
@ -1023,8 +1025,7 @@ static int want_object_in_pack(const struct object_id *oid,
|
||||
if (want != -1)
|
||||
return want;
|
||||
}
|
||||
|
||||
list_for_each(pos, &packed_git_mru) {
|
||||
list_for_each(pos, get_packed_git_mru(the_repository)) {
|
||||
struct packed_git *p = list_entry(pos, struct packed_git, mru);
|
||||
off_t offset;
|
||||
|
||||
@ -1042,7 +1043,8 @@ static int want_object_in_pack(const struct object_id *oid,
|
||||
}
|
||||
want = want_found_object(exclude, p);
|
||||
if (!exclude && want > 0)
|
||||
list_move(&p->mru, &packed_git_mru);
|
||||
list_move(&p->mru,
|
||||
get_packed_git_mru(the_repository));
|
||||
if (want != -1)
|
||||
return want;
|
||||
}
|
||||
@ -2669,7 +2671,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
|
||||
|
||||
memset(&in_pack, 0, sizeof(in_pack));
|
||||
|
||||
for (p = packed_git; p; p = p->next) {
|
||||
for (p = get_packed_git(the_repository); p; p = p->next) {
|
||||
struct object_id oid;
|
||||
struct object *o;
|
||||
|
||||
@ -2732,7 +2734,8 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
|
||||
static struct packed_git *last_found = (void *)1;
|
||||
struct packed_git *p;
|
||||
|
||||
p = (last_found != (void *)1) ? last_found : packed_git;
|
||||
p = (last_found != (void *)1) ? last_found :
|
||||
get_packed_git(the_repository);
|
||||
|
||||
while (p) {
|
||||
if ((!p->pack_local || p->pack_keep) &&
|
||||
@ -2741,7 +2744,7 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
|
||||
return 1;
|
||||
}
|
||||
if (p == last_found)
|
||||
p = packed_git;
|
||||
p = get_packed_git(the_repository);
|
||||
else
|
||||
p = p->next;
|
||||
if (p == last_found)
|
||||
@ -2777,7 +2780,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
|
||||
uint32_t i;
|
||||
struct object_id oid;
|
||||
|
||||
for (p = packed_git; p; p = p->next) {
|
||||
for (p = get_packed_git(the_repository); p; p = p->next) {
|
||||
if (!p->pack_local || p->pack_keep)
|
||||
continue;
|
||||
|
||||
@ -3148,7 +3151,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
prepare_packed_git();
|
||||
if (ignore_packed_keep) {
|
||||
struct packed_git *p;
|
||||
for (p = packed_git; p; p = p->next)
|
||||
for (p = get_packed_git(the_repository); p; p = p->next)
|
||||
if (p->pack_local && p->pack_keep)
|
||||
break;
|
||||
if (!p) /* no keep-able packs found */
|
||||
@ -3161,7 +3164,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
* also covers non-local objects
|
||||
*/
|
||||
struct packed_git *p;
|
||||
for (p = packed_git; p; p = p->next) {
|
||||
for (p = get_packed_git(the_repository); p; p = p->next) {
|
||||
if (!p->pack_local) {
|
||||
have_non_local_packs = 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user