read-cache.c: remove implicit dependency on the_index
[gitweb.git] / revision.c
index a2570397b6685fbd6e3a7d77ad7e2c554cc03772..0c6dc8c163fe2e21040b08b5762fc9409b4fb969 100644 (file)
@@ -63,10 +63,10 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
        while (tree_entry(&desc, &entry)) {
                switch (object_type(entry.mode)) {
                case OBJ_TREE:
-                       mark_tree_uninteresting(lookup_tree(entry.oid));
+                       mark_tree_uninteresting(lookup_tree(the_repository, entry.oid));
                        break;
                case OBJ_BLOB:
-                       mark_blob_uninteresting(lookup_blob(entry.oid));
+                       mark_blob_uninteresting(lookup_blob(the_repository, entry.oid));
                        break;
                default:
                        /* Subproject commit - not in this repository */
@@ -198,7 +198,7 @@ void add_head_to_pending(struct rev_info *revs)
        struct object *obj;
        if (get_oid("HEAD", &oid))
                return;
-       obj = parse_object(&oid);
+       obj = parse_object(the_repository, &oid);
        if (!obj)
                return;
        add_pending_object(revs, obj, "HEAD");
@@ -210,7 +210,7 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
 {
        struct object *object;
 
-       object = parse_object(oid);
+       object = parse_object(the_repository, oid);
        if (!object) {
                if (revs->ignore_missing)
                        return object;
@@ -247,10 +247,13 @@ static struct commit *handle_commit(struct rev_info *revs,
                        add_pending_object(revs, object, tag->tag);
                if (!tag->tagged)
                        die("bad tag");
-               object = parse_object(&tag->tagged->oid);
+               object = parse_object(the_repository, &tag->tagged->oid);
                if (!object) {
                        if (revs->ignore_missing_links || (flags & UNINTERESTING))
                                return NULL;
+                       if (revs->exclude_promisor_objects &&
+                           is_promisor_object(&tag->tagged->oid))
+                               return NULL;
                        die("bad object %s", oid_to_hex(&tag->tagged->oid));
                }
                object->flags |= flags;
@@ -1250,7 +1253,7 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)
 {
        struct all_refs_cb *cb = cb_data;
        if (!is_null_oid(oid)) {
-               struct object *o = parse_object(oid);
+               struct object *o = parse_object(the_repository, oid);
                if (o) {
                        o->flags |= cb->all_flags;
                        /* ??? CMDLINEFLAGS ??? */
@@ -1323,7 +1326,7 @@ static void add_cache_tree(struct cache_tree *it, struct rev_info *revs,
        int i;
 
        if (it->entry_count >= 0) {
-               struct tree *tree = lookup_tree(&it->oid);
+               struct tree *tree = lookup_tree(the_repository, &it->oid);
                add_pending_object_with_path(revs, &tree->object, "",
                                             040000, path->buf);
        }
@@ -1349,7 +1352,7 @@ static void do_add_index_objects_to_pending(struct rev_info *revs,
                if (S_ISGITLINK(ce->ce_mode))
                        continue;
 
-               blob = lookup_blob(&ce->oid);
+               blob = lookup_blob(the_repository, &ce->oid);
                if (!blob)
                        die("unable to add index blob to traversal");
                add_pending_object_with_path(revs, &blob->object, "",
@@ -1461,11 +1464,11 @@ void init_revisions(struct rev_info *revs, const char *prefix)
        revs->commit_format = CMIT_FMT_DEFAULT;
        revs->expand_tabs_in_log_default = 8;
 
-       init_grep_defaults();
-       grep_init(&revs->grep_filter, prefix);
+       init_grep_defaults(the_repository);
+       grep_init(&revs->grep_filter, the_repository, prefix);
        revs->grep_filter.status_only = 1;
 
-       diff_setup(&revs->diffopt);
+       repo_diff_setup(the_repository, &revs->diffopt);
        if (prefix && !revs->diffopt.prefix) {
                revs->diffopt.prefix = prefix;
                revs->diffopt.prefix_length = strlen(prefix);
@@ -1514,7 +1517,7 @@ static void prepare_show_merge(struct rev_info *revs)
                const struct cache_entry *ce = active_cache[i];
                if (!ce_stage(ce))
                        continue;
-               if (ce_path_match(ce, &revs->prune_data, NULL)) {
+               if (ce_path_match(&the_index, ce, &revs->prune_data, NULL)) {
                        prune_num++;
                        REALLOC_ARRAY(prune, prune_num);
                        prune[prune_num-2] = ce->name;
@@ -1578,8 +1581,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
                *dotdot = '\0';
        }
 
-       a_obj = parse_object(&a_oid);
-       b_obj = parse_object(&b_oid);
+       a_obj = parse_object(the_repository, &a_oid);
+       b_obj = parse_object(the_repository, &b_oid);
        if (!a_obj || !b_obj)
                return dotdot_missing(arg, dotdot, revs, symmetric);
 
@@ -1592,8 +1595,8 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
                struct commit *a, *b;
                struct commit_list *exclude;
 
-               a = lookup_commit_reference(&a_obj->oid);
-               b = lookup_commit_reference(&b_obj->oid);
+               a = lookup_commit_reference(the_repository, &a_obj->oid);
+               b = lookup_commit_reference(the_repository, &b_obj->oid);
                if (!a || !b)
                        return dotdot_missing(arg, dotdot, revs, symmetric);
 
@@ -2884,7 +2887,7 @@ static int mark_uninteresting(const struct object_id *oid,
                              uint32_t pos,
                              void *unused)
 {
-       struct object *o = parse_object(oid);
+       struct object *o = parse_object(the_repository, oid);
        o->flags |= UNINTERESTING | SEEN;
        return 0;
 }