builtin/show-branch: rewrite functions to work with object_id
[gitweb.git] / revision.c
index 7ddbaa083e9e59d3db270b96b47a20e6c99bdaa3..cfe3876ce832e85a28b21b5592f9c62b801525c9 100644 (file)
@@ -1218,7 +1218,8 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
        return 0;
 }
 
-static int handle_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int handle_one_ref(const char *path, const struct object_id *oid,
+                         int flag, void *cb_data)
 {
        struct all_refs_cb *cb = cb_data;
        struct object *object;
@@ -1226,9 +1227,9 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
        if (ref_excluded(cb->all_revs->ref_excludes, path))
            return 0;
 
-       object = get_reference(cb->all_revs, path, sha1, cb->all_flags);
+       object = get_reference(cb->all_revs, path, oid->hash, cb->all_flags);
        add_rev_cmdline(cb->all_revs, object, path, REV_CMD_REF, cb->all_flags);
-       add_pending_sha1(cb->all_revs, path, sha1, cb->all_flags);
+       add_pending_sha1(cb->all_revs, path, oid->hash, cb->all_flags);
        return 0;
 }
 
@@ -1304,9 +1305,12 @@ static int handle_one_reflog(const char *path, const unsigned char *sha1, int fl
 void add_reflogs_to_pending(struct rev_info *revs, unsigned flags)
 {
        struct all_refs_cb cb;
+       struct each_ref_fn_sha1_adapter wrapped_handle_one_reflog =
+               {handle_one_reflog, &cb};
+
        cb.all_revs = revs;
        cb.all_flags = flags;
-       for_each_reflog(handle_one_reflog, &cb);
+       for_each_reflog(each_ref_fn_adapter, &wrapped_handle_one_reflog);
 }
 
 static void add_cache_tree(struct cache_tree *it, struct rev_info *revs,