+static int ref_newer(const unsigned char *new_sha1, const unsigned char *old_sha1)
+{
+ if (!has_sha1_file(old_sha1))
+ return 0;
+ /*
+ * FIXME! It is not correct to say that the new one is newer
+ * just because we don't have the old one!
+ *
+ * We should really see if we can reach the old_sha1 commit
+ * from the new_sha1 one.
+ */
+ return 1;
+}
+
+static int local_ref_nr_match;
+static char **local_ref_match;
+static struct ref **local_ref_list;
+
+static int try_to_match(const char *refname, const unsigned char *sha1)
+{
+ struct ref *ref;
+ int len;
+
+ if (!path_match(refname, local_ref_nr_match, local_ref_match))
+ return 0;
+
+ len = strlen(refname)+1;
+ ref = xmalloc(sizeof(*ref) + len);
+ memset(ref->old_sha1, 0, 20);
+ memcpy(ref->new_sha1, sha1, 20);
+ memcpy(ref->name, refname, len);
+ ref->next = NULL;
+ *local_ref_list = ref;
+ local_ref_list = &ref->next;
+ return 0;
+}
+