summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-04-29 15:45:52 -0700
committerJunio C Hamano <gitster@pobox.com>2014-09-03 10:04:17 -0700
commitcba12021c3c932e42de838d0fc05d60b93790599 (patch)
tree51ef995b658433352875f1b575f643def56a57db /refs.c
parent04ad6223ec1163163c4f39308149bee852ee245f (diff)
downloadgit-cba12021c3c932e42de838d0fc05d60b93790599.tar.gz
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/refs.c b/refs.c
index a6b39ec2d7..fd6768429d 100644
--- a/refs.c
+++ b/refs.c
@@ -2173,15 +2173,6 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
return NULL;
}
-static struct ref_lock *lock_ref_sha1(const char *refname, const unsigned char *old_sha1)
-{
- char refpath[PATH_MAX];
- if (check_refname_format(refname, 0))
- return NULL;
- strcpy(refpath, mkpath("refs/%s", refname));
- return lock_ref_sha1_basic(refpath, old_sha1, 0, NULL);
-}
-
struct ref_lock *lock_any_ref_for_update(const char *refname,
const unsigned char *old_sha1,
int flags, int *type_p)
@@ -2391,8 +2382,12 @@ static void try_remove_empty_parents(char *name)
/* make sure nobody touched the ref, and unlink */
static void prune_ref(struct ref_to_prune *r)
{
- struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1);
+ struct ref_lock *lock;
+
+ if (check_refname_format(r->name + 5, 0))
+ return;
+ lock = lock_ref_sha1_basic(r->name, r->sha1, 0, NULL);
if (lock) {
unlink_or_warn(git_path("%s", r->name));
unlock_ref(lock);