Re: [PATCH v2] add: warn when -u or -A is used without filepattern

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

 



Hi Matthieu,

Matthieu Moy wrote:

> --- a/builtin/add.c
> +++ b/builtin/add.c
[...]
> @@ -392,8 +420,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
>  		die(_("-A and -u are mutually incompatible"));
>  	if (!show_only && ignore_missing)
>  		die(_("Option --ignore-missing can only be used together with --dry-run"));
> -	if ((addremove || take_worktree_changes) && !argc) {
> +	if (addremove)
> +		option_with_implicit_dot = "--all";
> +	if (take_worktree_changes)
> +		option_with_implicit_dot = "--update";

I agree with Junio that these are most often spelled as "-A" and "-u".

> +	if (option_with_implicit_dot && !argc) {
>  		static const char *here[2] = { ".", NULL };
> +		if (prefix)
> +			warn_pathless_add(option_with_implicit_dot);

For what it's worth, with or without s/--all/-A/ and s/--update/-u/,
Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

Thanks.  If someone wants to preserve the spelling of the option name
passed by the user, that can happen as a patch on top.
--
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]