From 3f5ef95b5e0cc0cbff06f747ba056e132a71033a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20=C3=85gren?= Date: Sat, 9 Sep 2017 08:57:17 +0200 Subject: [PATCH] refs/files-backend: correct return value in lock_ref_for_update MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Michael Haggerty Signed-off-by: Martin Ă…gren Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- refs/files-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 3d63639665..03df002759 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2801,7 +2801,7 @@ static int lock_ref_for_update(struct files_ref_store *refs, strbuf_addf(err, "cannot lock ref '%s': " "error reading reference", original_update_refname(update)); - ret = -1; + ret = TRANSACTION_GENERIC_ERROR; goto out; } } else if (check_old_oid(update, &lock->old_oid, err)) { -- 2.11.4.GIT