summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2014-12-12 09:57:03 +0100
committerJunio C Hamano <gitster@pobox.com>2014-12-22 10:13:16 -0800
commitc653e0343d04ba89040c8ba18d7ca2e55ece6338 (patch)
treed2b916795ed2979e860668ce68f4b78c3fbdb3d5
parent3581d793351dba4e4a2f779a72f39d6ae84c1c2c (diff)
downloadgit-mh/reflog-expire.tar.gz
refs.c: let fprintf handle the formattingmh/reflog-expire
Instead of calculating whether to put a plus or minus sign, offload the responsibilty to the fprintf function. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--refs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/refs.c b/refs.c
index 048fbbf50f..14e52caea5 100644
--- a/refs.c
+++ b/refs.c
@@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
printf("prune %s", message);
} else {
if (cb->newlog) {
- char sign = (tz < 0) ? '-' : '+';
- int zone = (tz < 0) ? (-tz) : tz;
- fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
+ fprintf(cb->newlog, "%s %s %s %lu %+05d\t%s",
sha1_to_hex(osha1), sha1_to_hex(nsha1),
- email, timestamp, sign, zone,
- message);
+ email, timestamp, tz, message);
hashcpy(cb->last_kept_sha1, nsha1);
}
if (cb->flags & EXPIRE_REFLOGS_VERBOSE)