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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 25, 2013, 23:06 UTC
Message-ID
<7vhaiu1a89.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1366663435-13598-1-git-send-email-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> 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)) {
Previous: Eric SunshineNext: Junio C Hamano
Message 77 of 85 in “What's cooking in git.git (Apr 2013, #05; Mon, 15)”
  1. Junio C HamanoApr 15, 2013
  2. Felipe ContrerasApr 15, 2013
  3. Junio C HamanoApr 15, 2013
  4. Felipe ContrerasApr 15, 2013
  5. Junio C HamanoApr 16, 2013
  6. Felipe ContrerasApr 16, 2013
  7. Thomas RastApr 16, 2013
  8. Felipe ContrerasApr 16, 2013
  9. Junio C HamanoApr 16, 2013
  10. Felipe ContrerasApr 16, 2013
  11. Phil HordApr 16, 2013
  12. Felipe ContrerasApr 16, 2013
  13. Phil HordApr 16, 2013
  14. Junio C HamanoApr 17, 2013
  15. Felipe ContrerasApr 17, 2013
  16. Junio C HamanoApr 17, 2013
  17. Felipe ContrerasApr 18, 2013
  18. Matthieu MoyApr 18, 2013
  19. Felipe ContrerasApr 18, 2013
  20. Ramkumar RamachandraApr 18, 2013
  21. Felipe ContrerasApr 18, 2013
  22. Ramkumar RamachandraApr 18, 2013
  23. Felipe ContrerasApr 18, 2013
  24. Ramkumar RamachandraApr 18, 2013
  25. Felipe ContrerasApr 18, 2013
  26. Ramkumar RamachandraApr 18, 2013
  27. Felipe ContrerasApr 18, 2013
  28. Ramkumar RamachandraApr 23, 2013
  29. Felipe ContrerasApr 23, 2013
  30. Phil HordApr 18, 2013
  31. Felipe ContrerasApr 18, 2013
  32. Phil HordApr 19, 2013
  33. Felipe ContrerasApr 20, 2013
  34. Jeff KingApr 15, 2013
  35. Øyvind A. HolmApr 15, 2013
  36. Jeff KingApr 16, 2013
  37. Jeff KingApr 16, 2013
  38. Eric SunshineApr 16, 2013
  39. Junio C HamanoApr 16, 2013
  40. Drew NorthupApr 16, 2013
  41. "What's cooking" between #05 and #06Junio C Hamano, Apr 16, 2013
  42. John KeepingApr 17, 2013
  43. Junio C HamanoApr 17, 2013
  44. Jens LehmannApr 17, 2013
  45. John KeepingApr 18, 2013
  46. Lukas FleischerApr 17, 2013
  47. Junio C HamanoApr 17, 2013
  48. Thomas RastApr 17, 2013
  49. Junio C HamanoApr 17, 2013
  50. Thomas RastApr 17, 2013
  51. Junio C HamanoApr 17, 2013
  52. Junio C HamanoApr 17, 2013
  53. Jeff KingApr 17, 2013
  54. Junio C HamanoApr 18, 2013
  55. git add <pathspec>... defaults to "-A"Junio C Hamano, Apr 18, 2013
  56. Jeff KingApr 18, 2013
  57. Junio C HamanoApr 18, 2013
  58. Jeff KingApr 18, 2013
  59. Junio C HamanoApr 18, 2013
  60. Jeff KingApr 18, 2013
  61. Junio C HamanoApr 18, 2013
  62. Jeff KingApr 18, 2013
  63. Junio C HamanoApr 18, 2013
  64. Jeff KingApr 19, 2013
  65. Jonathan NiederApr 19, 2013
  66. Junio C HamanoApr 19, 2013
  67. Jeff KingApr 19, 2013
  68. Junio C HamanoApr 19, 2013
  69. jc/add-2.0-delete-default (Re: What's cooking in git.git (Apr 2013, #05; Mon, 15))Jonathan Nieder, Apr 21, 2013
  70. Junio C HamanoApr 22, 2013
  71. Junio C HamanoApr 22, 2013
  72. 0/2 "git add -A/--no-all" finishing touchesJunio C Hamano, Apr 22, 2013
  73. 1/2 git add: --ignore-removal is a better named --no-allJunio C Hamano, Apr 22, 2013
  74. 2/2 git add: rephrase -A/--no-all warningJunio C Hamano, Apr 22, 2013
  75. 3/2 git add <pathspec>... defaults to "-A"Junio C Hamano, Apr 22, 2013
  76. Eric SunshineApr 23, 2013
  77. Junio C HamanoApr 25, 2013
  78. Junio C HamanoApr 25, 2013
  79. Jonathan NiederApr 25, 2013
  80. Junio C HamanoApr 25, 2013
  81. Junio C HamanoApr 25, 2013
  82. Jonathan NiederApr 25, 2013
  83. Junio C HamanoApr 26, 2013
  84. Junio C HamanoApr 26, 2013
  85. Jonathan NiederApr 26, 2013

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.