Re: [PATCH 06/11] reset_head(): make default_reflog_action optional

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

 



"Phillip Wood via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Phillip Wood <phillip.wood@xxxxxxxxxxxxx>
>
> This parameter is only needed when a ref is going to be updated and
> the caller does not pass an explicit reflog message. Callers that are
> just discarding changes in the working tree like create_autostash() do
> not update any refs so should not have to worry about passing this
> parameter.

This only talks about internal implementation details of passing a
parameter that may not be used, but ...

> -	ret = update_refs(oid, switch_to_branch, reflog_head, reflog_orig_head,
> -			  default_reflog_action, flags);
> +	if (oid != &head_oid || update_orig_head || switch_to_branch)
> +		ret = update_refs(oid, switch_to_branch, reflog_head,
> +				  reflog_orig_head, default_reflog_action,
> +				  flags);

... doesn't this have a more significant behaviour change?

I am not sure if comparison between oid and head_oid can safely
cheat like the patch does, or if it is necessary to do a proper oid
comparison, but either way, this would stop calling update_refs(),
which in turn means it would have an externally visible effect, like
a hook no longer getting called, doesn't it?

It would be a change for the good---calling post-checkout hook when
you did "git checkout (no other arguments)" feels wasteful, but it
deserves to be told to end users, I would think.

Again, a new test to protect the change would go well in the same
patch.

Thanks.





[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]

  Powered by Linux