@@ -108,7 +108,7 @@ static const char *bare_ref_name(const char *ref)
static int git_reftable_read_raw_ref(struct ref_store *ref_store,
const char *refname, struct object_id *oid,
struct strbuf *referent,
- unsigned int *type);
+ unsigned int *type, int *failure_errno);
static void clear_reftable_log_record(struct reftable_log_record *log)
{
@@ -425,13 +424,14 @@ static int fixup_symrefs(struct ref_store *ref_store,
for (i = 0; i < transaction->nr; i++) {
struct ref_update *update = transaction->updates[i];
struct object_id old_oid;
+ int failure_errno;
err = git_reftable_read_raw_ref(ref_store, update->refname,
&old_oid, &referent,
/* mutate input, like
files-backend.c */
- &update->type);
- if (err < 0 && errno == ENOENT &&
+ &update->type, &failure_errno);
+ if (err < 0 && failure_errno == ENOENT &&
is_null_oid(&update->old_oid)) {
err = 0;
}
@@ -1602,7 +1603,7 @@ static int reftable_error_to_errno(int err)
static int git_reftable_read_raw_ref(struct ref_store *ref_store,
const char *refname, struct object_id *oid,
struct strbuf *referent,
- unsigned int *type)
+ unsigned int *type, int *failure_errno)
{
struct git_reftable_ref_store *refs =
(struct git_reftable_ref_store *)ref_store;
@@ -1626,13 +1627,11 @@ static int git_reftable_read_raw_ref(struct ref_store *ref_store,
err = reftable_stack_read_ref(stack, refname, &ref);
if (err > 0) {
- errno = ENOENT;
+ *failure_errno = ENOENT;
err = -1;
goto done;
}
if (err < 0) {
- errno = reftable_error_to_errno(err);
- err = -1;
goto done;
}