packaging: Add contrib installation
[platform/upstream/git.git] / revision.c
index aa62212..7ec9b63 100644 (file)
@@ -124,11 +124,6 @@ static int path_and_oids_cmp(const void *hashmap_cmp_fn_data,
        return strcmp(e1->path, e2->path);
 }
 
-static void paths_and_oids_init(struct hashmap *map)
-{
-       hashmap_init(map, path_and_oids_cmp, NULL, 0);
-}
-
 static void paths_and_oids_clear(struct hashmap *map)
 {
        struct hashmap_iter iter;
@@ -139,7 +134,7 @@ static void paths_and_oids_clear(struct hashmap *map)
                free(entry->path);
        }
 
-       hashmap_free_entries(map, struct path_and_oids_entry, ent);
+       hashmap_clear_and_free(map, struct path_and_oids_entry, ent);
 }
 
 static void paths_and_oids_insert(struct hashmap *map,
@@ -213,7 +208,7 @@ void mark_trees_uninteresting_sparse(struct repository *r,
                                     struct oidset *trees)
 {
        unsigned has_interesting = 0, has_uninteresting = 0;
-       struct hashmap map;
+       struct hashmap map = HASHMAP_INIT(path_and_oids_cmp, NULL);
        struct hashmap_iter map_iter;
        struct path_and_oids_entry *entry;
        struct object_id *oid;
@@ -237,8 +232,6 @@ void mark_trees_uninteresting_sparse(struct repository *r,
        if (!has_uninteresting || !has_interesting)
                return;
 
-       paths_and_oids_init(&map);
-
        oidset_iter_init(trees, &iter);
        while ((oid = oidset_iter_next(&iter))) {
                struct tree *tree = lookup_tree(r, oid);
@@ -1248,12 +1241,14 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
                /*
                 * Have we seen the same patch id?
                 */
-               id = has_commit_patch_id(commit, &ids);
+               id = patch_id_iter_first(commit, &ids);
                if (!id)
                        continue;
 
                commit->object.flags |= cherry_flag;
-               id->commit->object.flags |= cherry_flag;
+               do {
+                       id->commit->object.flags |= cherry_flag;
+               } while ((id = patch_id_iter_next(id, &ids)));
        }
 
        free_patch_ids(&ids);
@@ -1834,7 +1829,6 @@ void repo_init_revisions(struct repository *r,
        revs->commit_format = CMIT_FMT_DEFAULT;
        revs->expand_tabs_in_log_default = 8;
 
-       init_grep_defaults(revs->repo);
        grep_init(&revs->grep_filter, revs->repo, prefix);
        revs->grep_filter.status_only = 1;