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

Re: [BUG] 'add -u' doesn't work from untracked subdir

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2009, 17:28 UTC
Message-ID
<7veiql1etz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090905084641.GA24865@darc.dnsalias.org>
Clemens Buchacher <drizzd@aon.at> writes:
Show 7 quoted lines
> "git add -u ." is friendly enough. Just like "git commit ." versus "git
> commit -a", which is exactly the same concept and should therefore have the
> same behavior.
>
> You are assuming that people are in a subdirectory because they want to
> limit the scope. But I am usually in a subdirectory for totally
> versioning-unrelated reasons.

Limit the scope of what you see in "ls" (no argument) output, shorten the paths you must type to non-git commands. They are the kind of "limit the scope" I meant, and they are totally versioning-unrelated. In other words, cwd-centric default helps the users (especially the new ones) by making git behave consistently with other commands.

So if anything, I personally think it would be much less surprising if all git commands worked relative to the cwd (not whole tree root) when run without path argument, at least from the newbie's point of view [*1*].

But notice that the above is qualified with "personally". An alternative would be to declare that in 1.8.0, all commands run without path argument will work on the whole tree and you have to give an explicit '.' when you want to limit their effect to the cwd.

This may be slightly less intuitive to newbies than the "relative to cwd", but nevertheless that is the course I would suggest us taking, because of the following observations:

 (1) if the commands work on the whole tree when run without paths, it is
     easy to limit to the cwd with "git frotz ." when you want to.
 (2) if the commands work on the cwd when run without paths, you have to
     always be aware how deep you are, and say "git frotz ../../.." when
     you want to extend their effects to the whole tree.
The latter is much more irritating.
Please also see:
    Message-ID: <7vy6ot4x61.fsf@alter.siamese.dyndns.org> ($gmane/127795)

think about the three questions there, and help us move the discussion forward.

The first part of the message has some comments related to your patch, by the way.

[Footnote]

*1* Except for the ones that cannot make any sense to limit their operation to a subdirectory you happen to be in (e.g. it would be insane if "git am" run to accept somebody's patch ignored paths outside your cwd).

Previous: Clemens BuchacherNext: Jakub Narebski
Message 23 of 35 in “[BUG] 'add -u' doesn't work from untracked subdir”
  1. SZEDER GáborSep 2, 2009
  2. Jeff KingSep 2, 2009
  3. Clemens BuchacherSep 4, 2009
  4. Jeff KingSep 5, 2009
  5. Junio C HamanoSep 5, 2009
  6. Jeff KingSep 5, 2009
  7. Junio C HamanoSep 5, 2009
  8. Jeff KingSep 5, 2009
  9. Junio C HamanoSep 5, 2009
  10. Clemens BuchacherSep 6, 2009
  11. Nanako ShiraishiSep 9, 2009
  12. Junio C HamanoSep 10, 2009
  13. Clemens BuchacherSep 10, 2009
  14. 1/2 grep: accept relative paths outside current working directoryClemens Buchacher, Sep 5, 2009
  15. 2/2 add 'scope' config optionClemens Buchacher, Sep 5, 2009
  16. 2/2 add 'scope' config optionClemens Buchacher, Sep 5, 2009
  17. Junio C HamanoSep 6, 2009
  18. grep: fix exit status if external_grep() returns errorClemens Buchacher, Sep 7, 2009
  19. Junio C HamanoSep 7, 2009
  20. Jeff KingSep 5, 2009
  21. Junio C HamanoSep 5, 2009
  22. Clemens BuchacherSep 5, 2009
  23. Junio C HamanoSep 5, 2009
  24. Jakub NarebskiSep 5, 2009
  25. Clemens BuchacherSep 5, 2009
  26. Junio C HamanoSep 5, 2009
  27. Matthieu MoySep 6, 2009
  28. Clemens BuchacherSep 6, 2009
  29. Matthieu MoySep 7, 2009
  30. SZEDER GáborSep 7, 2009
  31. Matthieu MoySep 7, 2009
  32. Nanako ShiraishiSep 7, 2009
  33. Junio C HamanoSep 7, 2009
  34. Clemens BuchacherSep 7, 2009
  35. SZEDER GáborSep 4, 2009

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.