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

From: Clemens Buchacher <[email-masked]>
Date: Thu, 10 Sep 2009 22:32:09 +0200

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