Merge branch 'master' of git://github.com/alshopov/git-po
[gitweb.git] / ref-filter.c
index 112955f006648315d048d1fba1c71862d538fe3f..0bccfceff2ae31200019838d9f2b67e13e32ef6f 100644 (file)
@@ -3,6 +3,8 @@
 #include "parse-options.h"
 #include "refs.h"
 #include "wildmatch.h"
+#include "object-store.h"
+#include "repository.h"
 #include "commit.h"
 #include "remote.h"
 #include "color.h"
@@ -1474,7 +1476,7 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj
                                       oid_to_hex(&oi->oid), ref->refname);
 
        if (oi->info.contentp) {
-               *obj = parse_object_buffer(&oi->oid, oi->type, oi->size, oi->content, &eaten);
+               *obj = parse_object_buffer(the_repository, &oi->oid, oi->type, oi->size, oi->content, &eaten);
                if (!obj) {
                        if (!eaten)
                                free(oi->content);
@@ -1761,7 +1763,7 @@ static enum contains_result contains_tag_algo(struct commit *candidate,
 
        for (p = want; p; p = p->next) {
                struct commit *c = p->item;
-               load_commit_graph_info(c);
+               load_commit_graph_info(the_repository, c);
                if (c->generation < cutoff)
                        cutoff = c->generation;
        }
@@ -1864,7 +1866,7 @@ static int match_name_as_path(const struct ref_filter *filter, const char *refna
                     refname[plen] == '/' ||
                     p[plen-1] == '/'))
                        return 1;
-               if (!wildmatch(p, refname, WM_PATHNAME))
+               if (!wildmatch(p, refname, flags))
                        return 1;
        }
        return 0;
@@ -1919,6 +1921,15 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
                return for_each_fullref_in("", cb, cb_data, broken);
        }
 
+       if (filter->ignore_case) {
+               /*
+                * we can't handle case-insensitive comparisons,
+                * so just return everything and let the caller
+                * sort it out.
+                */
+               return for_each_fullref_in("", cb, cb_data, broken);
+       }
+
        if (!filter->name_patterns[0]) {
                /* no patterns; we have to look at everything */
                return for_each_fullref_in("", cb, cb_data, broken);
@@ -1964,7 +1975,7 @@ static const struct object_id *match_points_at(struct oid_array *points_at,
 
        if (oid_array_lookup(points_at, oid) >= 0)
                return oid;
-       obj = parse_object(oid);
+       obj = parse_object(the_repository, oid);
        if (!obj)
                die(_("malformed object at '%s'"), refname);
        if (obj->type == OBJ_TAG)
@@ -2074,7 +2085,8 @@ static int ref_filter_handler(const char *refname, const struct object_id *oid,
         * non-commits early. The actual filtering is done later.
         */
        if (filter->merge_commit || filter->with_commit || filter->no_commit || filter->verbose) {
-               commit = lookup_commit_reference_gently(oid, 1);
+               commit = lookup_commit_reference_gently(the_repository, oid,
+                                                       1);
                if (!commit)
                        return 0;
                /* We perform the filtering for the '--contains' option... */
@@ -2431,7 +2443,8 @@ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
        if (get_oid(arg, &oid))
                die(_("malformed object name %s"), arg);
 
-       rf->merge_commit = lookup_commit_reference_gently(&oid, 0);
+       rf->merge_commit = lookup_commit_reference_gently(the_repository,
+                                                         &oid, 0);
        if (!rf->merge_commit)
                return opterror(opt, "must point to a commit", 0);