Skip to content

Commit

Permalink
refs.c: let fprintf handle the formatting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Beller authored and Junio C Hamano committed Dec 22, 2014
1 parent 3581d79 commit c653e03
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c653e03

Please sign in to comment.