]> git.ipfire.org Git - thirdparty/git.git/blobdiff - refs.c
Fix broken sha1 locking
[thirdparty/git.git] / refs.c
diff --git a/refs.c b/refs.c
index 134c0fc0150b56600dc6a9021e586e64db9f7ed2..7bd36e4f633968c1ae24a0c3bc1c054b000c9191 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -462,10 +462,12 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref,
 struct ref_lock *lock_ref_sha1(const char *ref,
        const unsigned char *old_sha1, int mustexist)
 {
+       char refpath[PATH_MAX];
        if (check_ref_format(ref))
                return NULL;
-       return lock_ref_sha1_basic(mkpath("refs/%s", ref),
-               5 + strlen(ref), old_sha1, mustexist);
+       strcpy(refpath, mkpath("refs/%s", ref));
+       return lock_ref_sha1_basic(refpath, strlen(refpath),
+               old_sha1, mustexist);
 }
 
 struct ref_lock *lock_any_ref_for_update(const char *ref,