Commit 7e4f461f98ca8599ac26846e9ca24d621574f33b

Stefan Sperling 2022-04-13T14:01:18

sort references by date for packing; newer commits should be processed first

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/repository_admin.c b/lib/repository_admin.c
index c1adcc4..a2cd689 100644
--- a/lib/repository_admin.c
+++ b/lib/repository_admin.c
@@ -75,6 +75,11 @@ get_reflist_object_ids(struct got_object_id ***ids, int *nobjects,
 	*ids = NULL;
 	*nobjects = 0;
 
+	err = got_reflist_sort(refs,
+	    got_ref_cmp_by_commit_timestamp_descending, repo);
+	if (err)
+		return err;
+
 	*ids = reallocarray(NULL, alloc_chunksz, sizeof(struct got_object_id *));
 	if (*ids == NULL)
 		return got_error_from_errno("reallocarray");