Skip to content

Commit 0e81d01

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fc31955 commit 0e81d01

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

refs/files-backend.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,10 +2430,7 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
24302430
* loose. The loose file name is the same as the
24312431
* lockfile name, minus ".lock":
24322432
*/
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))
24372434
return 1;
24382435
}
24392436
return 0;

0 commit comments

Comments
 (0)