]> git.ipfire.org Git - thirdparty/git.git/blobdiff - ref-filter.c
Merge branch 'js/azure-pipelines-msvc'
[thirdparty/git.git] / ref-filter.c
index 4613df8826818380f2b2554fce7fe409c0de0c56..6867e33648cb58d6836594a5cf145a58f81a884e 100644 (file)
@@ -79,7 +79,7 @@ static struct expand_data {
 } oi, oi_deref;
 
 struct ref_to_worktree_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        struct worktree *wt; /* key is wt->head_ref */
 };
 
@@ -1031,7 +1031,7 @@ static const char *copy_name(const char *buf)
                if (!strncmp(cp, " <", 2))
                        return xmemdupz(buf, cp - buf);
        }
-       return "";
+       return xstrdup("");
 }
 
 static const char *copy_email(const char *buf)
@@ -1039,10 +1039,10 @@ static const char *copy_email(const char *buf)
        const char *email = strchr(buf, '<');
        const char *eoemail;
        if (!email)
-               return "";
+               return xstrdup("");
        eoemail = strchr(email, '>');
        if (!eoemail)
-               return "";
+               return xstrdup("");
        return xmemdupz(email, eoemail + 1 - email);
 }
 
@@ -1772,7 +1772,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
         * If it is a tag object, see if we use a value that derefs
         * the object, and if we do grab the object it refers to.
         */
-       oi_deref.oid = ((struct tag *)obj)->tagged->oid;
+       oi_deref.oid = *get_tagged_oid((struct tag *)obj);
 
        /*
         * NEEDSWORK: This derefs tag only once, which
@@ -2003,7 +2003,7 @@ static const struct object_id *match_points_at(struct oid_array *points_at,
        if (!obj)
                die(_("malformed object at '%s'"), refname);
        if (obj->type == OBJ_TAG)
-               tagged_oid = &((struct tag *)obj)->tagged->oid;
+               tagged_oid = get_tagged_oid((struct tag *)obj);
        if (tagged_oid && oid_array_lookup(points_at, tagged_oid) >= 0)
                return tagged_oid;
        return NULL;
@@ -2172,7 +2172,8 @@ void ref_array_clear(struct ref_array *array)
        used_atom_cnt = 0;
 
        if (ref_to_worktree_map.worktrees) {
-               hashmap_free(&(ref_to_worktree_map.map), 1);
+               hashmap_free_entries(&(ref_to_worktree_map.map),
+                                       struct ref_to_worktree_entry, ent);
                free_worktrees(ref_to_worktree_map.worktrees);
                ref_to_worktree_map.worktrees = NULL;
        }