#include "cache.h"
#include "lockfile.h"
#include "bundle.h"
+#include "object-store.h"
+#include "repository.h"
#include "object.h"
#include "commit.h"
#include "diff.h"
struct ref_list *p = &header->prerequisites;
struct rev_info revs;
const char *argv[] = {NULL, "--all", NULL};
- struct object_array refs;
struct commit *commit;
int i, ret = 0, req_nr;
const char *message = _("Repository lacks these prerequisite commits:");
init_revisions(&revs, NULL);
for (i = 0; i < p->nr; i++) {
struct ref_list_entry *e = p->list + i;
- struct object *o = parse_object(&e->oid);
+ struct object *o = parse_object(the_repository, &e->oid);
if (o) {
o->flags |= PREREQ_MARK;
add_pending_object(&revs, o, e->name);
req_nr = revs.pending.nr;
setup_revisions(2, argv, &revs, NULL);
- refs = revs.pending;
- revs.leak_pending = 1;
-
if (prepare_revision_walk(&revs))
die(_("revision walk setup failed"));
if (commit->object.flags & PREREQ_MARK)
i--;
- for (i = 0; i < req_nr; i++)
- if (!(refs.objects[i].item->flags & SHOWN)) {
- if (++ret == 1)
- error("%s", message);
- error("%s %s", oid_to_hex(&refs.objects[i].item->oid),
- refs.objects[i].name);
- }
+ for (i = 0; i < p->nr; i++) {
+ struct ref_list_entry *e = p->list + i;
+ struct object *o = parse_object(the_repository, &e->oid);
+ assert(o); /* otherwise we'd have returned early */
+ if (o->flags & SHOWN)
+ continue;
+ if (++ret == 1)
+ error("%s", message);
+ error("%s %s", oid_to_hex(&e->oid), e->name);
+ }
- clear_commit_marks_for_object_array(&refs, ALL_REV_FLAGS);
- free(refs.objects);
+ /* Clean up objects used, as they will be reused. */
+ for (i = 0; i < p->nr; i++) {
+ struct ref_list_entry *e = p->list + i;
+ commit = lookup_commit_reference_gently(the_repository, &e->oid, 1);
+ if (commit)
+ clear_commit_marks(commit, ALL_REV_FLAGS);
+ }
if (verbose) {
struct ref_list *r;
if (revs->max_age == -1 && revs->min_age == -1)
goto out;
- buf = read_sha1_file(tag->oid.hash, &type, &size);
+ buf = read_object_file(&tag->oid, &type, &size);
if (!buf)
goto out;
line = memmem(buf, size, "\ntagger ", 8);
if (e->item->flags & UNINTERESTING)
continue;
- if (dwim_ref(e->name, strlen(e->name), oid.hash, &ref) != 1)
+ if (dwim_ref(e->name, strlen(e->name), &oid, &ref) != 1)
goto skip_write_ref;
- if (read_ref_full(e->name, RESOLVE_REF_READING, oid.hash, &flag))
+ if (read_ref_full(e->name, RESOLVE_REF_READING, &oid, &flag))
flag = 0;
display_ref = (flag & REF_ISSYMREF) ? e->name : ref;
* commit that is referenced by the tag, and not the tag
* itself.
*/
- if (oidcmp(&oid, &e->item->oid)) {
+ if (!oideq(&oid, &e->item->oid)) {
/*
* Is this the positive end of a range expressed
* in terms of a tag (e.g. v2.0 from the range
* "v1.0..v2.0")?
*/
- struct commit *one = lookup_commit_reference(&oid);
+ struct commit *one = lookup_commit_reference(the_repository,
+ &oid);
struct object *obj;
if (e->item == &(one->object)) {
int create_bundle(struct bundle_header *header, const char *path,
int argc, const char **argv)
{
- static struct lock_file lock;
+ struct lock_file lock = LOCK_INIT;
int bundle_fd = -1;
int bundle_to_stdout;
int ref_count = 0;