Re: [PATCH v2 11/14] reset_head(): take struct rebase_head_opts

[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 function takes a confusingly large number of parameters which
> makes it difficult to remember which order to pass them in. The
> following commits will add a couple more parameters which makes the
> problem worse. To address this change the function to take a struct of
> options. Using a struct means that it is no longer necessary to
> remember which order to pass the parameters in and anyone reading the
> code can easily see which value is passed to each parameter.

OK.  The documentation for members in the structure will serve as
the user manual for the reset_head() function.  Good.

> +struct reset_head_opts {
> +	/*
> +	 * The commit to checkout/reset to. Defaults to HEAD.
> +	 */
> +	const struct object_id *oid;
> +	/*
> +	 * Optional branch to switch to.
> +	 */
> +	const char *branch;
> +	/*
> +	 * Flags defined above.
> +	 */
> +	unsigned flags;
> +	/*
> +	 * Optional reflog message for HEAD, if this omitted but oid or branch
> +	 * are given then default_reflog_action must be given.
> +	 */

If we can enforce such a requirement in reset_head() implementation
with "if (condition) BUG(...)", we should do so to catch mistakes.

Thanks.  Looking good.




[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