employ new explicit "exists in index?" API
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index a3f2302292190b147a1cee092a26d47ace7a1228..d78860c46d95ea9785c83c08824355275393ed99 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -72,10 +72,6 @@ int check_refname_format(const char *refname, int flags)
 {
        int component_len, component_count = 0;
 
-       if (!strcmp(refname, "@"))
-               /* Refname is a single character '@'. */
-               return -1;
-
        while (1) {
                /* We are at the start of a path component. */
                component_len = check_refname_component(refname, flags);
@@ -634,7 +630,9 @@ struct ref_entry_cb {
 static int do_one_ref(struct ref_entry *entry, void *cb_data)
 {
        struct ref_entry_cb *data = cb_data;
+       struct ref_entry *old_current_ref;
        int retval;
+
        if (prefixcmp(entry->name, data->base))
                return 0;
 
@@ -642,10 +640,12 @@ static int do_one_ref(struct ref_entry *entry, void *cb_data)
              !ref_resolves_to_object(entry))
                return 0;
 
+       /* Store the old value, in case this is a recursive call: */
+       old_current_ref = current_ref;
        current_ref = entry;
        retval = data->fn(entry->name + data->trim, entry->u.value.sha1,
                          entry->flag, data->cb_data);
-       current_ref = NULL;
+       current_ref = old_current_ref;
        return retval;
 }
 
@@ -3196,14 +3196,6 @@ int update_ref(const char *action, const char *refname,
        return 0;
 }
 
-struct ref *find_ref_by_name(const struct ref *list, const char *name)
-{
-       for ( ; list; list = list->next)
-               if (!strcmp(list->name, name))
-                       return (struct ref *)list;
-       return NULL;
-}
-
 /*
  * generate a format suitable for scanf from a ref_rev_parse_rules
  * rule, that is replace the "%.*s" spec with a "%s" spec