Whoops.  Accidentally commented on the individual commit instead of on the PR diff.  Let me re-paste the comment here...

This section is okay. I'd slightly prefer it to match the style used with `should_head_by_updated` - i.e.

```c
if ((error = git_reference_has_log(ref)) < 0)
    goto on_error;

reference_has_log = (error > 0);
error = 0;

if (reference_has_log && (error = git_reflog_rename(...)) < 0)
    goto on_error;
```

but if that's the only change that needs to be made to have this patch merged, then it's not necessary and we can merge as is.

By the way, in this path you have to clear `error` to zero because we're going to return it just after (and we wouldn't want to return `1`). You don't have to do that with `should_head_by_updated` because it is immediately overwritten (but I wouldn't be against clearing it to zero just for clarity).