diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-05-15 10:29:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-15 14:12:31 -0700 |
commit | 4d0c51fc547e5d45825513816db3484c7ae16a87 (patch) | |
tree | 744ac6c76f7ddaad9766c9bb21385b37948f3340 | |
parent | 9c9d20f0c2c34ed286ef30cde30c813c485d19e6 (diff) | |
download | git-4d0c51fc547e5d45825513816db3484c7ae16a87.tar.gz |
refs.c: move the check for valid refname to lock_ref_sha1_basic
Move the check for check_refname_format from lock_any_ref_for_update
to lock_ref_sha1_basic. At some later stage we will get rid of
lock_any_ref_for_update completely.
This leaves lock_any_ref_for_updates as a no-op wrapper which could be removed.
But this wrapper is also called from an external caller and we will soon
make changes to the signature to lock_ref_sha1_basic that we do not want to
expose to that caller.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2044,6 +2044,9 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, int missing = 0; int attempts_remaining = 3; + if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) + return NULL; + lock = xcalloc(1, sizeof(struct ref_lock)); lock->lock_fd = -1; @@ -2135,8 +2138,6 @@ struct ref_lock *lock_any_ref_for_update(const char *refname, const unsigned char *old_sha1, int flags, int *type_p) { - if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) - return NULL; return lock_ref_sha1_basic(refname, old_sha1, flags, type_p); } |