git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 20, 2011, 21:22 UTC
Message-ID
<7vpqplv65o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vtyexv6wl.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
>> * 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 <gitster@pobox.com>
---
 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
Previous: Junio C HamanoNext: Matthieu Moy
Message 4 of 15 in “What's cooking in git.git (Mar 2011, #02; Sun, 20)”
  1. Junio C HamanoMar 20, 2011
  2. Jens LehmannMar 20, 2011
  3. Junio C HamanoMar 20, 2011
  4. Junio C HamanoMar 20, 2011
  5. Matthieu MoyMar 20, 2011
  6. Junio C HamanoMar 21, 2011
  7. Jeff KingMar 21, 2011
  8. Junio C HamanoMar 21, 2011
  9. add: make "add -u/-A" update full tree without pathspecJunio C Hamano, Mar 23, 2011
  10. add: make "add -u/-A" update full tree without pathspec (step 2)Junio C Hamano, Mar 23, 2011
  11. add: make "add -u/-A" update full tree without pathspec (step 3)Junio C Hamano, Mar 23, 2011
  12. Nguyen Thai Ngoc DuyMar 23, 2011
  13. Junio C HamanoMar 23, 2011
  14. Ævar Arnfjörð BjarmasonMar 22, 2011
  15. Junio C HamanoMar 22, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.