[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: [PATCH 08/12] refs files-backend: assume cb->newlog if !EXPIRE_REFLOGS_DRY_RUN
From: Ævar Arnfjörð Bjarmason <avarab () gmail ! com>
Date: 2021-11-30 21:38:10
Message-ID: patch-08.12-adbec242a7a-20211130T213319Z-avarab () gmail ! com
[Download RAW message or body]
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>
---
refs/files-backend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 4b14f30d48f..451c4e2a052 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -3099,12 +3099,12 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
if ((*cb->should_prune_fn)(ooid, noid, email, timestamp, tz,
message, policy_cb)) {
- if (!cb->newlog)
+ if (cb->flags & EXPIRE_REFLOGS_DRY_RUN)
printf("would prune %s", message);
else if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
printf("prune %s", message);
} else {
- if (cb->newlog) {
+ if (!(cb->flags & EXPIRE_REFLOGS_DRY_RUN)) {
fprintf(cb->newlog, "%s %s %s %"PRItime" %+05d\t%s",
oid_to_hex(ooid), oid_to_hex(noid),
email, timestamp, tz, message);
--
2.34.1.877.g7d5b0a3b8a6
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic