Skip to content

Commit ce0af24

Browse files
mhaggergitster
authored andcommitted
delete_ref_loose(): inline function
It was hardly doing anything anymore, and had only one caller. Signed-off-by: Michael Haggerty <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0e81d01 commit ce0af24

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

refs/files-backend.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,21 +2421,6 @@ static int repack_without_refs(struct files_ref_store *refs,
24212421
return ret;
24222422
}
24232423

2424-
static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
2425-
{
2426-
assert(err);
2427-
2428-
if (!(flag & REF_ISPACKED) || flag & REF_ISSYMREF) {
2429-
/*
2430-
* loose. The loose file name is the same as the
2431-
* lockfile name, minus ".lock":
2432-
*/
2433-
if (unlink_or_msg(git_path("%s", lock->ref_name), err))
2434-
return 1;
2435-
}
2436-
return 0;
2437-
}
2438-
24392424
static int files_delete_refs(struct ref_store *ref_store,
24402425
struct string_list *refnames, unsigned int flags)
24412426
{
@@ -3788,9 +3773,13 @@ static int files_transaction_commit(struct ref_store *ref_store,
37883773

37893774
if (update->flags & REF_DELETING &&
37903775
!(update->flags & REF_LOG_ONLY)) {
3791-
if (delete_ref_loose(lock, update->type, err)) {
3792-
ret = TRANSACTION_GENERIC_ERROR;
3793-
goto cleanup;
3776+
if (!(update->type & REF_ISPACKED) ||
3777+
update->type & REF_ISSYMREF) {
3778+
/* It is a loose reference. */
3779+
if (unlink_or_msg(git_path("%s", lock->ref_name), err)) {
3780+
ret = TRANSACTION_GENERIC_ERROR;
3781+
goto cleanup;
3782+
}
37943783
}
37953784

37963785
if (!(update->flags & REF_ISPRUNING))

0 commit comments

Comments
 (0)