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

Re: [RFC] git rm -u

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 21, 2013, 09:23 UTC
Message-ID
<7v622qhouc.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAA01Csrv26WrrJDAo-1cr+rW6rYFGQZpYgtafEh=Wgtzswdv_g@mail.gmail.com>
Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
> Do you mean "git add" will be disallowed without "." or ":/" argument?
> Or will this change in future and "git add" without argument will me
> "whole tree", same as ":/" ?

No. This is only about "git add -u<RETURN>", not any other forms of "git add ...with or without other args...".

"git add -u<RETURN>" historically meant, and it still means, to "update the index with every change in the working tree", even when you are in a subdirectory.

Back when "git add -u" was invented, we didn't have the ":/", which lets us tell commands that take pathspecs "I want everything from the top of the working tree.". If "git add -u<RETURN>" limited its operation to the current directory, after working everywhere in the working tree, cd'ing around and ending up to be in a subdirectory somwhere deep, you had to "cd ../../.. && git add -u", which was cumbersome. If "git add -u" always meant the whole tree, limiting it to the current directory with "git add -u .<RETURN>" was easy, and that is why the default was chosen to the "whole tree".

Because we have ":/" these days, changing something that limits its action to the current directory by default to instead work on the whole tree no longer makes much sense. That is, if we _were_ to change "git add -u<RETURN>", it would be in the opposite direction, i.e. to update the index only with the paths below the current directory.

Such a change has to be done carefully. Existing users do expect the current behaviour, so we have to first _break_ their fingers and habits and train them to say "add -u :/" when they mean the whole tree operation. Silently accepting "add -u" and changing its meaning to update the index only with the paths below the current directory will cause them trouble by leaving changes they _thought_ they added out of the index, and is an unacceptable change.

The first step of migration is "git add -u<RETURN>" that loudly warns, so that uses of that form in scripts are updated before the second step to avoid a flag-day breakage and start traing fingers and habits of the users.

The second step is to make "add -u<RETURN>" fail, again with a message that tells users to be explicit and add ":/" or "." at the end if they mean "the whole tree" or "the current directory".

After keeping Git in that secnd step for sufficiently long time to train users to type ":/" or "." explicitly, we can then finally switch the default of "git add -u<RETURN>" to limit it to the current directory, instead of failing the command.

Previous: Matthieu MoyNext: Junio C Hamano
Message 22 of 53 in “[RFC] git rm -u”
  1. Eric James Michael RitzJan 19, 2013
  2. Tomas CarneckyJan 19, 2013
  3. Antoine PelisseJan 19, 2013
  4. Eric James Michael RitzJan 19, 2013
  5. Junio C HamanoFeb 25, 2013
  6. Antoine PelisseFeb 25, 2013
  7. Matthieu MoyFeb 25, 2013
  8. Antoine PelisseFeb 25, 2013
  9. Matthieu MoyFeb 25, 2013
  10. Junio C HamanoFeb 25, 2013
  11. Jonathan NiederJan 19, 2013
  12. Eric James Michael RitzJan 19, 2013
  13. Matthieu MoyJan 20, 2013
  14. Junio C HamanoJan 20, 2013
  15. Junio C HamanoJan 20, 2013
  16. Martin von ZweigbergkJan 20, 2013
  17. Matthieu MoyJan 21, 2013
  18. Junio C HamanoJan 20, 2013
  19. Eric James Michael RitzJan 20, 2013
  20. Piotr KrukowieckiJan 21, 2013
  21. Matthieu MoyJan 21, 2013
  22. Junio C HamanoJan 21, 2013
  23. Junio C HamanoJan 21, 2013
  24. Matthieu MoyJan 21, 2013
  25. Junio C HamanoJan 21, 2013
  26. Piotr KrukowieckiJan 21, 2013
  27. add: warn when -u or -A is used without filepatternMatthieu Moy, Jan 21, 2013
  28. Robin RosenbergJan 21, 2013
  29. Matthieu MoyJan 21, 2013
  30. Robin RosenbergJan 21, 2013
  31. Junio C HamanoJan 21, 2013
  32. Piotr KrukowieckiJan 21, 2013
  33. Matthieu MoyJan 21, 2013
  34. Matthieu MoyJan 21, 2013
  35. Jonathan NiederJan 21, 2013
  36. Matthieu MoyJan 22, 2013
  37. add: warn when -u or -A is used without filepatternMatthieu Moy, Jan 25, 2013
  38. Junio C HamanoJan 25, 2013
  39. Matthieu MoyJan 27, 2013
  40. Junio C HamanoJan 27, 2013
  41. Matthieu MoyJan 28, 2013
  42. add: warn when -u or -A is used without filepatternMatthieu Moy, Jan 28, 2013
  43. Jonathan NiederJan 28, 2013
  44. Michael J GruberJan 28, 2013
  45. Junio C HamanoJan 28, 2013
  46. Matthieu MoyJan 28, 2013
  47. Junio C HamanoJan 28, 2013
  48. Junio C HamanoFeb 14, 2013
  49. Junio C HamanoFeb 14, 2013
  50. Matthieu MoyFeb 15, 2013
  51. Jonathan NiederJan 27, 2013
  52. Duy NguyenJan 22, 2013
  53. Junio C HamanoJan 22, 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.