Merge branch 'jl/submodule-update-retire-orig-flags'
[gitweb.git] / commit.c
index 26c1d5406d3b1229ffdd2b152a05dcb601ebe5ca..11509ffc471c548a1367068b3d7c2f15d19361f4 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -79,7 +79,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)
        if (get_sha1_committish(name, sha1))
                return NULL;
        commit = lookup_commit_reference(sha1);
-       if (!commit || parse_commit(commit))
+       if (parse_commit(commit))
                return NULL;
        return commit;
 }
@@ -384,6 +384,22 @@ unsigned commit_list_count(const struct commit_list *l)
        return c;
 }
 
+struct commit_list *copy_commit_list(struct commit_list *list)
+{
+       struct commit_list *head = NULL;
+       struct commit_list **pp = &head;
+       while (list) {
+               struct commit_list *new;
+               new = xmalloc(sizeof(struct commit_list));
+               new->item = list->item;
+               new->next = NULL;
+               *pp = new;
+               pp = &new->next;
+               list = list->next;
+       }
+       return head;
+}
+
 void free_commit_list(struct commit_list *list)
 {
        while (list) {