Skip to content

Commit 7c28875

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 994b328 commit 7c28875

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

refs/files-backend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,12 +3105,12 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
31053105

31063106
if ((*cb->should_prune_fn)(ooid, noid, email, timestamp, tz,
31073107
message, policy_cb)) {
3108-
if (!cb->newlog)
3108+
if (cb->flags & EXPIRE_REFLOGS_DRY_RUN)
31093109
printf("would prune %s", message);
31103110
else if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
31113111
printf("prune %s", message);
31123112
} else {
3113-
if (cb->newlog) {
3113+
if (!(cb->flags & EXPIRE_REFLOGS_DRY_RUN)) {
31143114
fprintf(cb->newlog, "%s %s %s %"PRItime" %+05d\t%s",
31153115
oid_to_hex(ooid), oid_to_hex(noid),
31163116
email, timestamp, tz, message);

0 commit comments

Comments
 (0)