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

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

 



Hi,

Matthieu Moy wrote:

> The inconsistancy of 'git add -u' and 'git add -A' are particularly
> problematic since other 'git add' subcommands (namely 'git add -p' and
> 'git add -e') are tree-wide by default.
>
> Flipping the default now is unacceptable, so this patch starts training
> users to type explicitely 'git add -u|-A :/' or 'git add -u|-A .', to prepare
> for the next steps:

Thanks for tackling this.

> --- a/builtin/add.c
> +++ b/builtin/add.c
[...]
> +	if (option_with_implicit_dot && !argc) {
> +		/*
> +		 * To be consistant with "git add -p" and most Git
> +		 * commands, we should default to being tree-wide, but
> +		 * this is not the original behavior and can't be
> +		 * changed until users trained themselves not to type
> +		 * "git add -u" or "git add -A". For now, we warn and
> +		 * keep the old behavior. Later, this warning can be
> +		 * turned into a die(...), and eventually we may
> +		 * reallow the command with a new behavior.
> +		 */
> +		warning(_("The behavior of 'git add %s' with no path argument will change in a future\n"

Would it be possible to make this conditional on cwd not being at the
toplevel (the case where "git add -u :/" and "git add -u ." have
different behavior)?  E.g.,

		static const char *here[2] = { ".", NULL };
		if (prefix)
			warning(...);

Thanks,
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]