Re: [PATCH 08/23] Extract function should_expire_reflog_ent()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 05, 2014 at 12:08:20AM +0100, Michael Haggerty wrote:
> Extracted from expire_reflog_ent() a function that is solely
> responsible for deciding whether a reflog entry should be expired. By
> separating this "business logic" from the mechanics of actually
> expiring entries, we are working towards the goal of encapsulating
> reflog expiry within the refs API, with policy decided by a callback
> function passed to it by its caller.
> 
> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>

Reviewed-by: Stefan Beller <sbeller@xxxxxxxxxx>

The comments below are just thoughts, which don't need to be
included into this commit.


> +	if (should_expire_reflog_ent(osha1, nsha1, email, timestamp, tz,
> +				     message, cb_data)) {
> +		if (!cb->newlog)
> +			printf("would prune %s", message);
> +		else if (cb->cmd->verbose)
> +			printf("prune %s", message);

While this commit is just shoveling code around, we don't want to introduce
changes here. So a question for a possible later follow up:
"git reflog" is listed as an ancillary manipulator, which still is porcelain.
So we maybe want to translate "[would] prune"?


> +			char sign = (tz < 0) ? '-' : '+';
> +			int zone = (tz < 0) ? (-tz) : tz;
> +			fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
> +				sha1_to_hex(osha1), sha1_to_hex(nsha1),
> +				email, timestamp, sign, zone,
> +				message);

This is fine for just moving code around and reviewing.
I send a patch on top of this one to remove the manual calculation of the 
sign and zone and let the fprintf function figure it out.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]