refs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN
It's not possible for "cb->newlog" to be NULL if !EXPIRE_REFLOGS_DRY_RUN, since files_reflog_expire() would have error()'d and taken the "goto failure" branch if it couldn't open the file. By not using the "newlog" field private to "file-backend.c"'s "struct expire_reflog_cb", we can move this verbosity logging to "builtin/reflog.c" in a subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Dec 22, 2021 at 05:06 UTC
7c28875bcd3c05dca34246e89c23a90898375592
1 file changed
+2
-2
refs/files-backend.c
+2
-2
@@ -3105,12 +3105,12 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
3105
3106
if ((*cb->should_prune_fn)(ooid, noid, email, timestamp, tz,
3107
message, policy_cb)) {
3108
- if (!cb->newlog)
3108
+ if (cb->flags & EXPIRE_REFLOGS_DRY_RUN)
3109
printf("would prune %s", message);
3110
else if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
3111
printf("prune %s", message);
3112
} else {
3113
- if (cb->newlog) {
3113
+ if (!(cb->flags & EXPIRE_REFLOGS_DRY_RUN)) {
3114
fprintf(cb->newlog, "%s %s %s %"PRItime" %+05d\t%s",
3115
oid_to_hex(ooid), oid_to_hex(noid),
3116
email, timestamp, tz, message);