}
/* Look up all the requirements, warn about missing objects.. */
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
if (verbose)
fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
for (i = 0; i < max; i++) {
- struct object *obj = get_indexed_object(i);
+ struct object *obj = get_indexed_object(the_repository, i);
if (obj)
check_object(obj);
break;
}
- object = parse_object_or_die(&oid, arg);
+ object = parse_object_or_die(the_repository, &oid, arg);
if (!seen_dashdash)
verify_non_filename(prefix, arg);
add_object_array_with_path(object, arg, &list, oc.mode, oc.path);
{
unsigned i, max, foreign_nr = 0;
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
if (verbose)
progress = start_delayed_progress(the_repository,
_("Checking objects"), max);
for (i = 0; i < max; i++) {
- foreign_nr += check_object(get_indexed_object(i));
+ foreign_nr += check_object(get_indexed_object(the_repository, i));
display_progress(progress, i + 1);
}
base = get_base_commit(&cfg, list, nr);
if (base) {
reset_revision_walk();
- clear_object_flags(UNINTERESTING);
+ clear_object_flags(the_repository, UNINTERESTING);
prepare_bases(&bases, base, list, nr);
}
} else if (all) {
int i, max;
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
for (i = 0; i < max; i++) {
- struct object *obj = get_indexed_object(i);
+ struct object *obj = get_indexed_object(the_repository, i);
if (!obj || obj->type != OBJ_COMMIT)
continue;
show_name(obj, NULL,
if (!peel_iterated_oid(the_repository, oid, &peeled))
oid = &peeled;
- object = parse_object_or_die(oid, refname);
+ object = parse_object_or_die(the_repository, oid, refname);
if (object->type == OBJ_COMMIT)
object->flags |= NEEDS_BITMAP;
const char *name = *argv++;
if (!repo_get_oid(the_repository, name, &oid)) {
- struct object *object = parse_object_or_die(&oid,
+ struct object *object = parse_object_or_die(the_repository, &oid,
name);
add_pending_object(&revs, object, "");
}
if (!peel_iterated_oid(revs->repo, oid, &peeled))
oid = &peeled;
- object = parse_object_or_die(oid, refname);
+ object = parse_object_or_die(revs->repo, oid, refname);
if (object->type != OBJ_COMMIT)
return 0;
if (*end)
die(_("malformed line: %s"), buf.buf);
- object = parse_object_or_die(&oid, NULL);
+ object = parse_object_or_die(revs->repo, &oid, NULL);
if (preferred)
object->flags |= NEEDS_BITMAP;
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "commit-graph.h"
#include "loose.h"
-unsigned int get_max_object_index(void)
+unsigned int get_max_object_index(const struct repository *repo)
{
- return the_repository->parsed_objects->obj_hash_size;
+ return repo->parsed_objects->obj_hash_size;
}
-struct object *get_indexed_object(unsigned int idx)
+struct object *get_indexed_object(const struct repository *repo,
+ unsigned int idx)
{
- return the_repository->parsed_objects->obj_hash[idx];
+ return repo->parsed_objects->obj_hash[idx];
}
static const char *object_type_strings[] = {
return obj;
}
-struct object *parse_object_or_die(const struct object_id *oid,
+struct object *parse_object_or_die(struct repository *repo,
+ const struct object_id *oid,
const char *name)
{
- struct object *o = parse_object(the_repository, oid);
+ struct object *o = parse_object(repo, oid);
if (o)
return o;
}
}
-void clear_object_flags(unsigned flags)
+void clear_object_flags(struct repository *repo, unsigned flags)
{
int i;
- for (i=0; i < the_repository->parsed_objects->obj_hash_size; i++) {
- struct object *obj = the_repository->parsed_objects->obj_hash[i];
+ for (i=0; i < repo->parsed_objects->obj_hash_size; i++) {
+ struct object *obj = repo->parsed_objects->obj_hash[i];
if (obj)
obj->flags &= ~flags;
}
/*
* Return the current number of buckets in the object hashmap.
*/
-unsigned int get_max_object_index(void);
+unsigned int get_max_object_index(const struct repository *repo);
/*
* Return the object from the specified bucket in the object hashmap.
*/
-struct object *get_indexed_object(unsigned int);
+struct object *get_indexed_object(const struct repository *repo,
+ unsigned int);
/*
* This can be used to see if we have heard of the object before, but
* "name" parameter is not NULL, it is included in the error message
* (otherwise, the hex object ID is given).
*/
-struct object *parse_object_or_die(const struct object_id *oid, const char *name);
+struct object *parse_object_or_die(struct repository *repo, const struct object_id *oid,
+ const char *name);
/* Given the result of read_sha1_file(), returns the object after
* parsing it. eaten_p indicates if the object has a borrowed copy
*/
void object_array_clear(struct object_array *array);
-void clear_object_flags(unsigned flags);
+void clear_object_flags(struct repository *repo, unsigned flags);
/*
* Clear the specified object flags from all in-core commit objects from
revs->tag_objects = tmp_tags;
reset_revision_walk();
- clear_object_flags(UNINTERESTING);
+ clear_object_flags(repo, UNINTERESTING);
/*
* Then add the boundary commit(s) as fill-in traversal tips.
struct object *object = revs->pending.objects[i].item;
if (object->type == OBJ_NONE)
- parse_object_or_die(&object->oid, NULL);
+ parse_object_or_die(revs->repo, &object->oid, NULL);
while (object->type == OBJ_TAG) {
struct tag *tag = (struct tag *) object;
else
object_list_insert(object, &wants);
- object = parse_object_or_die(get_tagged_oid(tag), NULL);
+ object = parse_object_or_die(revs->repo, get_tagged_oid(tag), NULL);
object->flags |= (tag->object.flags & UNINTERESTING);
}
}
strbuf_trim(&buf);
if (!get_oid_hex(buf.buf, &oid)) {
- object = parse_object_or_die(&oid, buf.buf);
+ object = parse_object_or_die(the_repository, &oid, buf.buf);
add_pending_object(revs, object, "");
}
strbuf_release(&buf);
return 0;
}
- object = parse_object_or_die(oid, path);
+ object = parse_object_or_die(the_repository, oid, path);
add_pending_object(revs, object, "");
return 0;
switch (type) {
case OBJ_TAG:
case OBJ_COMMIT:
- obj = parse_object_or_die(oid, NULL);
+ obj = parse_object_or_die(the_repository, oid, NULL);
break;
case OBJ_TREE:
obj = (struct object *)lookup_tree(the_repository, oid);
void reset_revision_walk(void)
{
- clear_object_flags(SEEN | ADDED | SHOWN | TOPO_WALK_EXPLORED | TOPO_WALK_INDEGREE);
+ clear_object_flags(the_repository,
+ SEEN | ADDED | SHOWN | TOPO_WALK_EXPLORED | TOPO_WALK_INDEGREE);
}
static int mark_uninteresting(const struct object_id *oid,
* SHALLOW (excluded) and NOT_SHALLOW (included) should not be
* set at this point. But better be safe than sorry.
*/
- clear_object_flags(both_flags);
+ clear_object_flags(the_repository, both_flags);
is_repository_shallow(the_repository); /* make sure shallows are read */
}
}
- nr = get_max_object_index();
+ nr = get_max_object_index(the_repository);
for (i = 0; i < nr; i++) {
- struct object *o = get_indexed_object(i);
+ struct object *o = get_indexed_object(the_repository, i);
if (o && o->type == OBJ_COMMIT)
o->flags &= ~SEEN;
}
* Prepare the commit graph to track what refs can reach what
* (new) shallow commits.
*/
- nr = get_max_object_index();
+ nr = get_max_object_index(the_repository);
for (i = 0; i < nr; i++) {
- struct object *o = get_indexed_object(i);
+ struct object *o = get_indexed_object(the_repository, i);
if (!o || o->type != OBJ_COMMIT)
continue;
cmd_in = xfdopen(cmd->in, "w");
- for (i = get_max_object_index(); 0 < i; ) {
- o = get_indexed_object(--i);
+ for (i = get_max_object_index(the_repository); 0 < i; ) {
+ o = get_indexed_object(the_repository, --i);
if (!o)
continue;
if (reachable && o->type == OBJ_COMMIT)
o->flags &= ~TMP_MARK;
}
}
- for (i = get_max_object_index(); 0 < i; i--) {
- o = get_indexed_object(i - 1);
+ for (i = get_max_object_index(the_repository); 0 < i; i--) {
+ o = get_indexed_object(the_repository, i - 1);
if (o && o->type == OBJ_COMMIT &&
(o->flags & TMP_MARK)) {
add_object_array(o, NULL, reachable);
}
if (!o)
- o = parse_object_or_die(&oid, refname_nons);
+ o = parse_object_or_die(the_repository, &oid, refname_nons);
if (!(o->flags & WANTED)) {
o->flags |= WANTED;
enum fetch_state state = FETCH_PROCESS_ARGS;
struct upload_pack_data data;
- clear_object_flags(ALL_FLAGS);
+ clear_object_flags(the_repository, ALL_FLAGS);
upload_pack_data_init(&data);
data.use_sideband = LARGE_PACKET_MAX;