]> git.proxmox.com Git - libgit2.git/commitdiff
Changed commit time sorting to be descending (from newest to oldest).
authorVicent Marti <tanoku@gmail.com>
Tue, 25 May 2010 20:00:55 +0000 (22:00 +0200)
committerAndreas Ericsson <ae@op5.se>
Wed, 2 Jun 2010 08:32:07 +0000 (10:32 +0200)
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
src/commit.c
tests/t0403-lists.c

index 9b52f4120bf54829149cb3ef756dba5018fb812f..2e3e1ba4b6f21a028ff2d8f17febfe22fe93afe3 100644 (file)
@@ -350,7 +350,7 @@ void git_commit_list_timesort(git_commit_list *list)
                     e = q, q = q->next, q_size--;
 
                 else if (q_size == 0 || q == NULL ||
-                    p->commit->commit_time <= q->commit->commit_time)
+                    p->commit->commit_time >= q->commit->commit_time)
                     e = p, p = p->next, p_size--;
 
                 else
index c16281e3250d7103ad6149960c6918b2ffa459ff..ff4fd6b1cde132c6cc6278ad7873d7047c897d2f 100644 (file)
@@ -12,10 +12,10 @@ BEGIN_TEST(list_timesort_test)
     time_t previous_time;
 
 #define TEST_SORTED() \
-    previous_time = 0;\
+    previous_time = INT_MAX;\
     for (n = list.head; n != NULL; n = n->next)\
     {\
-        must_be_true(n->commit->commit_time >= previous_time);\
+        must_be_true(n->commit->commit_time <= previous_time);\
         previous_time = n->commit->commit_time;\
     }