Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:55:55

Possibly related (same subject, not in this thread)

Hi Matthieu,

Matthieu Moy wrote:
quoted hunk ↗ jump to hunk
--- a/builtin/add.c
+++ b/builtin/add.c
[...]
quoted hunk ↗ jump to hunk
@@ -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 <redacted>

Thanks.  If someone wants to preserve the spelling of the option name
passed by the user, that can happen as a patch on top.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help