files_log_ref_write: new function
[gitweb.git] / builtin / reflog.c
index f96ca2a27dcb9ac6daa3aa110ff657981296502a..cf1145e635c559206a6b0d61e41321fa914e5e42 100644 (file)
@@ -218,7 +218,6 @@ static int keep_entry(struct commit **it, unsigned char *sha1)
  */
 static void mark_reachable(struct expire_reflog_policy_cb *cb)
 {
-       struct commit *commit;
        struct commit_list *pending;
        unsigned long expire_limit = cb->mark_limit;
        struct commit_list *leftover = NULL;
@@ -228,11 +227,8 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb)
 
        pending = cb->mark_list;
        while (pending) {
-               struct commit_list *entry = pending;
                struct commit_list *parent;
-               pending = entry->next;
-               commit = entry->item;
-               free(entry);
+               struct commit *commit = pop_commit(&pending);
                if (commit->object.flags & REACHABLE)
                        continue;
                if (parse_commit(commit))