t7004: factor out gpg setup
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index e83bbf804ad004437dbfd27f16e2e1f089bdd9fa..6f313a9e0cdec2400a993cf7c3dfa87529a493ae 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1476,7 +1476,7 @@ int write_ref_sha1(struct ref_lock *lock,
        }
        o = parse_object(sha1);
        if (!o) {
-               error("Trying to write ref %s with nonexistant object %s",
+               error("Trying to write ref %s with nonexistent object %s",
                        lock->ref_name, sha1_to_hex(sha1));
                unlock_ref(lock);
                return -1;
@@ -1851,6 +1851,12 @@ int update_ref(const char *action, const char *refname,
        return 0;
 }
 
+int ref_exists(char *refname)
+{
+       unsigned char sha1[20];
+       return !!resolve_ref(refname, sha1, 1, NULL);
+}
+
 struct ref *find_ref_by_name(const struct ref *list, const char *name)
 {
        for ( ; list; list = list->next)