* difference in behavior bw ls-files and ls-tree on paths in submodules
@ 2019-07-03 19:33 Yaroslav O Halchenko
0 siblings, 0 replies; only message in thread
From: Yaroslav O Halchenko @ 2019-07-03 19:33 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-03 20:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-03 19:33 difference in behavior bw ls-files and ls-tree on paths in submodules Yaroslav O Halchenko
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).