commit 0c52533

default  ·  2022-12-02 20:19:46 +0000 UTC
parent 908e068
New function object_here_by_md5().
1 files changed,  +9, -4
M data.c
M data.c
+9, -4
 1@@ -411,11 +411,18 @@ d_char *_object_fn(const char *id)
 2 }
 3 
 4 
 5+int object_here_by_md5(char *id)
 6+/* checks if an object is already downloaded */
 7+{
 8+    xs *fn = _object_fn_by_md5(id);
 9+    return mtime(fn) > 0.0;
10+}
11+
12+
13 int object_here(char *id)
14 /* checks if an object is already downloaded */
15 {
16     xs *fn = _object_fn(id);
17-
18     return mtime(fn) > 0.0;
19 }
20 
21@@ -818,10 +825,8 @@ d_char *timeline_top_level(d_char *list)
22             if (!object_parent(line, line2, sizeof(line2)))
23                 break;
24 
25-            xs *pfn = _object_fn_by_md5(line2);
26-
27             /* well, there is a parent... but if it's not there, use this */
28-            if (mtime(pfn) == 0.0)
29+            if (!object_here_by_md5(line2))
30                 break;
31 
32             /* it's here! try again with its own parent */