Thread (1 message) 1 message, 1 author, 2016-06-15

Re: What's cooking in git.git (Mar 2011, #02; Sun, 20)

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:49
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
quoted
* nd/rfc-add-u-full-tree (2011-02-07) 1 commit
 - add: make "add -u" update full tree without pathspec

A three-phase migration that:

 (1) first only warns when we would deviate from traditional behaviour and
     suggest adding "." if the user wants to limit it to cwd, but doesn't
     actually add full-tree, in the next release;

 (2) warn that we have changed the behaviour and suggest adding "." if the
     user wants to limit it to cwd, and actually do full-tree, in 1.8.0;

 (3) remove the warning, in 1.8.X (for X at least 2 or more).

would be a good way forward.
... and here is how the first step would look like.
... and here is the second step meant for 1.8.0 release.

The third step for 1.8.2 or later should be trivially obvious, so I
wouldn't bother sending it out.

-- >8 --
Subject: [PATCH] add -u: tree-wide without pathspec

The warning still remains in this version, but has to stay here
to help people who skipped late 1.7.X releases.  Unfortunately
we do not have a good way to let people who have already heard
about the transition to squelch it yet. That has to wait until
we have a magic ":/" pathspec that would mean to match from the
top of the working tree no matter where $cwd is.  At that point,
people can say "git add -u :/" to squelch the warning.

Signed-off-by: Junio C Hamano <redacted>
---
 builtin/add.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 443d3bb..0ece4b1 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -360,11 +360,11 @@ static int add_files(struct dir_struct *dir, int flags)
 }
 
 static const char *warn_add_u_without_pathspec_msg[] = {
-	"In release 1.8.0, running 'git add -u' from a subdirectory",
-	"without giving any pathspec WILL take effect on the whole",
-	"working tree, not just the part under the current directory.",
-	"Please make it a habit to say 'git add -u .' when you mean",
-	"to only add paths under the current directory."
+	"Since release 1.8.0, running 'git add -u' from a subdirectory",
+	"without giving any pathspec takes effect on the whole working",
+	"tree, not just the part under the current directory.",
+	"Please say 'git add -u .' if you want to only add paths under",
+	"the current directory."
 };
 
 static void warn_add_u_without_pathspec(void)
@@ -403,11 +403,13 @@ 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 (take_worktree_changes && !argc && prefix)
+		warn_add_u_without_pathspec();
+
+	if (addremove && !argc) {
 		static const char *here[2] = { ".", NULL };
 
-		if (take_worktree_changes && prefix)
-			warn_add_u_without_pathspec();
 		argc = 1;
 		argv = here;
 	}
-- 
1.7.4.1.514.ga171c
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help