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 <mhag...@alum.mit.edu> Signed-off-by: Martin Ågren <martin.ag...@gmail.com> --- v3: this is a new patch, as suggested by Michael 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 a2b3df21b..ad05d1d5f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2311,7 +2311,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.14.1.151.g45c1275a3.dirty