From: Yaroslav O Halchenko <debian@onerussian.com>
To: git@vger.kernel.org
Subject: difference in behavior bw ls-files and ls-tree on paths in submodules
Date: Wed, 3 Jul 2019 15:33:05 -0400 [thread overview]
Message-ID: <20190703193305.GF21553@hopa.kiewit.dartmouth.edu> (raw)
Dear Git gurus,
A quick question on either such difference in behavior is intended or
ideally should be "fixed" by making it more consistent.
# prep demo usecase with a submodule sub/ containing a file 123
$> mkdir /tmp/testrepo; cd /tmp/testrepo; git init; touch 123; git add 123; git commit -m 123
Initialized empty Git repository in /tmp/testrepo/.git/
[master (root-commit) 00864cd] 123
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 123
$> git submodule add $PWD ./sub && git commit -m 'added self as a submodule'
Cloning into '/tmp/testrepo/sub'...
done.
[master e92dd9a] added self as a submodule
2 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 160000 su
ls-tree provides information on the submodule if I point it to the file within
submodule (even without -r):
$> git ls-tree HEAD -l sub/123
160000 commit 00864cd776e8c870feb89db28c5e9ad185ed2a8e - sub
whenever ls-files provides no output for a path within submodule and only if I
point to the submodule directory directly:
$> git ls-files --stage sub/123
$> git ls-files --stage sub/
160000 00864cd776e8c870feb89db28c5e9ad185ed2a8e 0 sub
I wonder
- if that is somehow intended (so there is a good reason for such a
behavior)?
- is there a good/quick way to figure out "parent path as known to git"
similarly as ls-tree behaves, but for "ls-files" (i.e. a worktree, which might
have submodules renamed but not yet committed etc)?
Thank you in advance!
--
Yaroslav O. Halchenko
Center for Open Neuroscience http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
reply other threads:[~2019-07-03 20:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190703193305.GF21553@hopa.kiewit.dartmouth.edu \
--to=debian@onerussian.com \
--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).