git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joey Hess <id@joeyh.name>
To: git@vger.kernel.org
Subject: git ls-files --with-tree documentation
Date: Fri, 19 Oct 2018 14:33:35 -0400	[thread overview]
Message-ID: <20181019183335.GA12353@kitenet.net> (raw)

       --with-tree=<tree-ish>
           When using --error-unmatch to expand the user supplied <file> (i.e.
           path pattern) arguments to paths, pretend that paths which were
           removed in the index since the named <tree-ish> are still present.
           Using this option with -s or -u options does not make any sense.

This seems to say that it only affects it when --error-unmatch is used,
but in fact it goes deeper; for example I can use it to list files that
are present in either the current work tree or some other branch:

joey@darkstar:/tmp/v> git checkout foo
joey@darkstar:/tmp/v> git ls-files --with-tree=master
in-foo
in-master
joey@darkstar:/tmp/v> git ls-files
in-foo
joey@darkstar:/tmp/v> git ls-tree master 
100644 blob 0242cc10fdf4e9afdfd0928c2a209d4545780168	in-master

This is very useful behavior, but I'm not sure if I should rely on it
behaving this way in the future, given the documentation.

t/t3060-ls-files-with-tree.sh does indeed test that it
"should add entries from named tree", and it does it without using
--error-unmatch.

How about changing the documentation to something like this to make
more explicit what it does.

       --with-tree=<tree-ish>
           Treat all files in the <tree-ish> as if they were present in the index.
           When using --error-unmatch to expand the user supplied <file> (i.e.
           path pattern) arguments to paths, this has the effect that paths which were
           removed in the index since the named <tree-ish> are still present.
           Using this option with -s or -u options does not make any sense.

-- 
see shy jo

             reply	other threads:[~2018-10-19 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 18:33 Joey Hess [this message]
2018-10-22  3:22 ` git ls-files --with-tree documentation Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181019183335.GA12353@kitenet.net \
    --to=id@joeyh.name \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).