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

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

From
Clemens Buchacher <drizzd@aon.at>
Date
Sep 10, 2009, 20:32 UTC
Message-ID
<20090910203209.GA27391@localhost>
In-Reply-To
<7vmy527f0b.fsf@alter.siamese.dyndns.org>
On Thu, Sep 10, 2009 at 12:53:40PM -0700, Junio C Hamano wrote:
> If this were going to happen as a list concensus, I am very tempted to
> suggest that we at least _consider_ applying the same rule even to
> ls-files and ls-tree.  That would impact scripts, so we need to be extra
> careful, though.

I originally thought those commands should be consistent with plain "ls", simply because of their name. However, ls-files is already inconsistent because "ls-files <subdir>" lists files relative to the current directory, as opposed to "ls <subdir>", which does so relative to <subdir>. And ls-tree is even more different from "ls".

So I don't think users are tempted to associate those commands with the behavior they are used from "ls". From that perspective it would therefore be ok to traverse the entire tree by default. To me that seems perfectly natural, especially for ls-tree.

In case of ls-files, I don't know. Its current behavior certainly did not bother me so far. But the same arguments as for "add -u" apply if you think of doing something like "git ls-files -u | cut -f2 | xargs git add", for example.

I can't really speak for the impact on scripts. But that is certainly an issue, more so than with "add -u" or "grep", which are more typically used interactively.

> If we try to give a sensible default to make it easier for the user,
> perhaps we should also default to HEAD when the user did not specify which
> tree-ish to archive from.  This is a topic in a separate thread.
I don't see why not.
> *3* Command line pathspec of course should honor cwd as before.
No argument there.
Clemens
Previous: Junio C HamanoNext: Clemens Buchacher
Message 13 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.