Skip to content

Commit 3f5ef95

Browse files
Martin Ågrengitster
authored andcommitted
refs/files-backend: correct return value in lock_ref_for_update
In one code path we return a literal -1 and not a symbolic constant. The value -1 would be interpreted as TRANSACTION_NAME_CONFLICT, which is wrong. Use TRANSACTION_GENERIC_ERROR instead (that is the only other return value we have to choose from). Noticed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 851e1fb commit 3f5ef95

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

refs/files-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
28012801
strbuf_addf(err, "cannot lock ref '%s': "
28022802
"error reading reference",
28032803
original_update_refname(update));
2804-
ret = -1;
2804+
ret = TRANSACTION_GENERIC_ERROR;
28052805
goto out;
28062806
}
28072807
} else if (check_old_oid(update, &lock->old_oid, err)) {

0 commit comments

Comments
 (0)