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

Re: [PATCHv2 3/3] git-add: rename -u to -a

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 28, 2011, 06:40 UTC
Message-ID
<7v39n8ll0s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTintuaM+p7XKmTy+hOa80nkbph7MP00cvEA+oHZJ@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> Should -u now print warnings to help script writers migrate to -a? Or
> do we plan to keep hidden -u forever?

I'd rather not to apply 2 and 3 from this series for now, until we have a more reasonable solution. Yes, I said "add --add-tracked" _might_ be worth considering, but that is in contrast to "add --tracked" which was out of the question.

Like it or not, "add -u" has already been quite established, and the 'u' stands for "update(d)" (i.e. "run update-index to the files updated in the work tree"), which I think makes perfect sense.

I would suggest just keeping "add -u" as is. As I said in the review in the previous round, if Michael really wants to, it probably is Ok to give "commit -a" a synonym "commit --update".

I further find that the verb form "--update" doesn't rhyme well as the option name to select what classes of paths are operated on; it might make sense to change the fully spelled version of the option for both commands from "--update" to "--updated" while we are at it. This would not bother end users at all, as parse-options will complete "--update" typed by the user or in scripts uniquely to "--updated" just fine.

Michael seems to be resisting against introducing "commit --update", and I understand one reason is because "status -u" means something totally different from "updated paths"; I am somewhat sympathetic to that fear.

But we started making "status" independent from being "commit --dry-run" in 1.7.0 for a reason---it would be Ok if "status -u" means something completely different from "commit -u", _as long as_ existing "commit -u" does not make much sense. I think that is the case here.

I don't think the distinction between "commit -a" vs "commit -A" is all that bad. When people talk about "all" files in the context of SCM, we almost always think about already tracked paths, and other files do not get into the picture unless you first "add" them (this is not limited to git; even "svn commit" or "cvs commit" wouldn't touch untracked paths). For this reason, it is not unexpected that the normal version of "all" excludes untracked files, and you would need to ask for the unusual version of "all" to include them (i.e. "commit -A" or "add -A") when dealing with usual SCM commands.

The same argument however does _NOT_ hold for "add", as "add" (especially in other SCM's context) is about making paths that haven't been tracked so far into tracked ones; iow, it is natural to expect that "all" would mean more than normal "all" (i.e. "all what are tracked") in the context of the "add" command (and "add" command only).

IOW, renaming "add -u" to "add -a" and having "add -a" vs "add -A" is more confusing than necessary, because of the nature of the word "add" that has a connotation of affecting paths that have been untracked so far, and keeping "add -u" and "add -A" distinct to avoid confusion is probably a reasonable solution to avoid "which variant of 'all' are we talking about" confusion. This compromise unfortunately does not give us the uniformity between '-a' vs '-A' applied to 'add' vs 'commit'. That is why I would suggest '-u' vs '-A' if we _really_ want to have such a uniformity between two commands, i.e. not adding "add -a" but adding "commit -u".

Previous: Nguyen Thai Ngoc DuyNext: Michael J Gruber
Message 15 of 30 in “add/commit -u/-a/-A”
  1. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 25, 2011
  2. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 25, 2011
  3. Junio C HamanoFeb 25, 2011
  4. 2/3 git-commit: rename --all to --trackMichael J Gruber, Feb 25, 2011
  5. Junio C HamanoFeb 25, 2011
  6. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 25, 2011
  7. Junio C HamanoFeb 25, 2011
  8. Michael J GruberFeb 26, 2011
  9. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 27, 2011
  10. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 27, 2011
  11. Junio C HamanoFeb 27, 2011
  12. 2/3 git-commit: rename --all to --all-trackedMichael J Gruber, Feb 27, 2011
  13. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 27, 2011
  14. Nguyen Thai Ngoc DuyFeb 27, 2011
  15. Junio C HamanoFeb 28, 2011
  16. Michael J GruberFeb 28, 2011
  17. Miles BaderFeb 28, 2011
  18. Michael J GruberFeb 28, 2011
  19. Miles BaderFeb 28, 2011
  20. Snipping on this list (Was: Re: [PATCHv2 3/3] git-add: rename -u to -a)Michael J Gruber, Feb 28, 2011
  21. Junio C HamanoFeb 28, 2011
  22. Miles BaderFeb 28, 2011
  23. Michael J GruberFeb 28, 2011
  24. Matthieu MoyFeb 28, 2011
  25. Michael J GruberFeb 28, 2011
  26. Tor ArntsenFeb 28, 2011
  27. Michael J GruberFeb 28, 2011
  28. Matthieu MoyFeb 28, 2011
  29. Michael J GruberFeb 28, 2011
  30. Junio C HamanoFeb 28, 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.