refs.c: remove lock_ref_sha1

lock_ref_sha1 was only called from one place in refs.c and only provided a check that the refname was sane before adding back the initial "refs/" part of the ref path name, the initial "refs/" that this caller had already stripped off before calling lock_ref_sha1. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ronnie Sahlberg committed Apr 29, 2014 at 15:45 UTC cba12021c3c932e42de838d0fc05d60b93790599
1 file changed +5 -10
refs.c
+5 -10
@@ -2173,15 +2173,6 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
2173 return NULL;
2174 }
2175
2176 -static struct ref_lock *lock_ref_sha1(const char *refname, const unsigned char *old_sha1)
2177 -{
2178 - char refpath[PATH_MAX];
2179 - if (check_refname_format(refname, 0))
2180 - return NULL;
2181 - strcpy(refpath, mkpath("refs/%s", refname));
2182 - return lock_ref_sha1_basic(refpath, old_sha1, 0, NULL);
2183 -}
2184 -
2176 struct ref_lock *lock_any_ref_for_update(const char *refname,
2177 const unsigned char *old_sha1,
2178 int flags, int *type_p)
@@ -2391,8 +2382,12 @@ static void try_remove_empty_parents(char *name)
2382 /* make sure nobody touched the ref, and unlink */
2383 static void prune_ref(struct ref_to_prune *r)
2384 {
2394 - struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1);
2385 + struct ref_lock *lock;
2386 +
2387 + if (check_refname_format(r->name + 5, 0))
2388 + return;
2389
2390 + lock = lock_ref_sha1_basic(r->name, r->sha1, 0, NULL);
2391 if (lock) {
2392 unlink_or_warn(git_path("%s", r->name));
2393 unlock_ref(lock);