]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sha1_name.c
t1503: use test_must_be_empty
[thirdparty/git.git] / sha1_name.c
index 6ccd3a53f8fc6130000c4bf3ba4cd646f512de53..7098b10e3db0caef02ae2daef8f0624e641aada4 100644 (file)
@@ -540,8 +540,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                        char *tmp = xstrndup(str + at + 2, reflog_len);
                        at_time = approxidate_careful(tmp, &errors);
                        free(tmp);
-                       if (errors)
+                       if (errors) {
+                               free(real_ref);
                                return -1;
+                       }
                }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {
@@ -837,7 +839,7 @@ static int handle_one_ref(const char *path,
        }
        if (object->type != OBJ_COMMIT)
                return 0;
-       commit_list_insert_by_date((struct commit *)object, list);
+       commit_list_insert((struct commit *)object, list);
        return 0;
 }
 
@@ -1364,6 +1366,7 @@ static int get_sha1_with_context_1(const char *name,
                if (!only_to_die && namelen > 2 && name[1] == '/') {
                        struct commit_list *list = NULL;
                        for_each_ref(handle_one_ref, &list);
+                       commit_list_sort_by_date(&list);
                        return get_sha1_oneline(name + 2, sha1, list);
                }
                if (namelen < 3 ||