Re: [PATCH v2] add: warn when -u or -A is used without filepattern
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jan 27, 2013, 12:22 UTC
- Message-ID
- <20130127122226.GB7670@elie.Belkin>
- In-Reply-To
- <1359110978-20054-1-git-send-email-Matthieu.Moy@imag.fr>
Hi Matthieu,
Matthieu Moy wrote:
> --- a/builtin/add.c > +++ b/builtin/add.c
[...]
Show 9 quoted lines
> @@ -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@gmail.com>
Thanks. If someone wants to preserve the spelling of the option name passed by the user, that can happen as a patch on top.