delete_ref_loose(): derive loose reference path from lock
It is simpler to derive the path to the file that must be deleted from "lock->ref_name" than from the lock_file object. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Jan 6, 2017 at 17:22 UTC
0e81d016f11ce93494b73d68220f59cf4b5a1da2
1 file changed
+1
-4
refs/files-backend.c
+1
-4
@@ -2430,10 +2430,7 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
2430
* loose. The loose file name is the same as the
2431
* lockfile name, minus ".lock":
2432
*/
2433
- char *loose_filename = get_locked_file_path(lock->lk);
2434
- int res = unlink_or_msg(loose_filename, err);
2435
- free(loose_filename);
2436
- if (res)
2433
+ if (unlink_or_msg(git_path("%s", lock->ref_name), err))
2434
return 1;
2435
}
2436
return 0;