summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-06-07 07:32:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-20 18:49:00 (GMT)
commit841caad903f2b160e9f5ff05f961d20ad9085ddc (patch)
tree524afe94d06cefcf32c5d64b760615105127faff /refs
parente3f510393c9d373f2969badc2b8afe179803a0fa (diff)
downloadgit-841caad903f2b160e9f5ff05f961d20ad9085ddc.zip
git-841caad903f2b160e9f5ff05f961d20ad9085ddc.tar.gz
git-841caad903f2b160e9f5ff05f961d20ad9085ddc.tar.bz2
lock_ref_for_update(): avoid a symref resolution
If we're overwriting a symref with a SHA-1, we need to resolve the value of the symref (1) to check against update->old_sha1 and (2) to write to its reflog. However, we've already read the symref itself and know its referent. So there is no need to read the symref's value through the symref; we can read the referent directly. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 6f8fecd..769e5c4 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -3479,7 +3479,7 @@ static int lock_ref_for_update(struct ref_update *update,
* the transaction, so we have to read it here
* to record and possibly check old_sha1:
*/
- if (read_ref_full(update->refname, 0,
+ if (read_ref_full(referent.buf, 0,
lock->old_oid.hash, NULL)) {
if (update->flags & REF_HAVE_OLD) {
strbuf_addf(err, "cannot lock ref '%s': "