Re: [PATCH 0/2] "git add -A/--no-all" finishing touches

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Applying Jonathan's idea on top of the early part that has graduated
> to 'master', here is to add "--ignore-removal" (which is a more
> natural way to say "--no-all") and use it in the warning message.
>
> Junio C Hamano (2):
>   git add: --ignore-removal is a better named --no-all
>   git add: rephrase -A/--no-all warning
>
>  Documentation/git-add.txt | 10 ++++++----
>  builtin/add.c             | 23 +++++++++++++++++------
>  2 files changed, 23 insertions(+), 10 deletions(-)

I am planning to fast-track this to 'master' for 1.8.3, to
complement Jonathan's "add -u/-A without pathspec" warning.

It would be nice if people can eyeball the behaviour of tonight's
'next', find glitches (if any) and help polishing it before the
feature freeze.

One thing I noticed about Jonathan's warn_pathless_add() thing is
that even though it knows for which path we would behave differently
between the current version and Git 2.0, the warning message does
not say which path outside the current directory would be added if
not restricted with an explicit ".", and leaves the reader in
suspense.

We may want to fix it by tweaking the end of the message, perhaps?

 builtin/add.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index d4b40f2..24a2d6f 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -36,7 +36,7 @@ struct update_callback_data {
 static const char *option_with_implicit_dot;
 static const char *short_option_with_implicit_dot;
 
-static void warn_pathless_add(void)
+static void warn_pathless_add(const char *path)
 {
 	static int shown;
 	assert(option_with_implicit_dot && short_option_with_implicit_dot);
@@ -67,12 +67,16 @@ static void warn_pathless_add(void)
 		  "  git add %s .\n"
 		  "  (or git add %s .)\n"
 		  "\n"
-		  "With the current Git version, the command is restricted to "
-		  "the current directory.\n"
+		  "With the current Git version, the command is limited to the current"
+		  "directory, and paths like '%s'\n"
+		  "that %s are not added.\n"
 		  ""),
 		option_with_implicit_dot, short_option_with_implicit_dot,
 		option_with_implicit_dot, short_option_with_implicit_dot,
-		option_with_implicit_dot, short_option_with_implicit_dot);
+		option_with_implicit_dot, short_option_with_implicit_dot,
+		path,
+		(!strcmp(short_option_with_implicit_dot, "-u")
+		 ? _("are modified") : _("are new")));
 }
 
 static int fix_unmerged_status(struct diff_filepair *p,
@@ -136,7 +140,7 @@ static void update_callback(struct diff_queue_struct *q,
 		 */
 		if (implicit_dot &&
 		    strncmp_icase(path, implicit_dot, implicit_dot_len)) {
-			warn_pathless_add();
+			warn_pathless_add(path);
 			continue;
 		}
 		switch (fix_unmerged_status(p, data)) {
--
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]