Re: [PATCH 3/3] builtins: check for startup_info->help, print and exit early

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

 



Nguyán ThÃi Ngác Duy wrote:

> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -667,6 +667,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		OPT_END(),
>  	};
>  
> +	if (startup_info->help)
> +		usage_with_options(builtin_branch_usage, options);
> +
>  	git_config(git_branch_config, NULL);
>  
>  	if (branch_use_color == -1)

One has to work hard to trigger this one.

	git init foo
	cd foo
	>.git/refs/heads/master
	git branch -h

Produces:

	fatal: Failed to resolve HEAD as a valid ref.

> --- a/builtin/checkout-index.c
> +++ b/builtin/checkout-index.c
> @@ -241,6 +241,9 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
>  		OPT_END()
>  	};
>  
> +	if (startup_info->help)
> +		usage_with_options(builtin_checkout_index_usage, builtin_checkout_index_options);
> +
>  	git_config(git_default_config, NULL);
>  	state.base_dir = "";
>  	prefix_length = prefix ? strlen(prefix) : 0;

	git init foo
	cd foo
	>.git/index
	git checkout-index -h

Produces:

	fatal: index file smaller than expected

> --- a/builtin/commit.c
> +++ b/builtin/commit.c

I'm stopping here.  But maybe some test cases like this would make the
series clearer.

Hope that helps,
Jonathan
--
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]