{"thread":{"id":"51424","subject":"difference in behavior bw ls-files and ls-tree on paths in submodules","startedAt":"2019-07-03T20:06:56Z","lastAt":"2019-07-03T20:06:56Z","messageCount":1,"participants":["Yaroslav O Halchenko"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378570","messageId":"20190703193305.GF21553@hopa.kiewit.dartmouth.edu","threadId":"51424","inReplyTo":null,"subject":"difference in behavior bw ls-files and ls-tree on paths in submodules","fromName":"Yaroslav O Halchenko","fromEmail":"debian@onerussian.com","sentAt":"2019-07-03T19:33:05Z","receivedAt":"2019-07-03T20:06:56Z","isPatch":false,"sender":{"key":"debian@onerussian.com","avatar":"https://gravatar.com/avatar/9d2f005048a0274a9c26bc47a51f580e2bf631dfedfdb18370f65e08e4250317?d=mp&s=160"},"body":"Dear Git gurus,\n\nA quick question on either such difference in behavior is intended or\nideally should be \"fixed\" by making it more consistent.\n\n\t# prep demo usecase with a submodule sub/ containing a file 123\n\n\t$> mkdir /tmp/testrepo; cd /tmp/testrepo; git init; touch 123; git add 123; git commit -m 123\n\tInitialized empty Git repository in /tmp/testrepo/.git/\n\t[master (root-commit) 00864cd] 123\n\t 1 file changed, 0 insertions(+), 0 deletions(-)\n\t  create mode 100644 123\n\n\t$> git submodule add $PWD ./sub && git commit -m 'added self as a submodule'\n\tCloning into '/tmp/testrepo/sub'...                                         \n\tdone.\n\t[master e92dd9a] added self as a submodule\n\t 2 files changed, 4 insertions(+)\n\t create mode 100644 .gitmodules\n\t create mode 160000 su\n\nls-tree provides information on the submodule if I point it to the file within\nsubmodule (even without -r):\n\n\t$> git ls-tree HEAD -l sub/123                                              \n\t160000 commit 00864cd776e8c870feb89db28c5e9ad185ed2a8e       -\tsub\n\nwhenever ls-files provides no output for a path within submodule and only if I\npoint to the submodule directory directly:\n\n\t$> git ls-files --stage sub/123\n\t$> git ls-files --stage sub/   \n\t160000 00864cd776e8c870feb89db28c5e9ad185ed2a8e 0\tsub\n\nI wonder \n\n- if that is somehow intended (so there is a good reason for such a\nbehavior)?\n\n- is there a good/quick way to figure out \"parent path as known to git\"\nsimilarly as ls-tree behaves, but for \"ls-files\" (i.e. a worktree, which might\nhave submodules renamed but not yet committed etc)?\n\nThank you in advance!\n-- \nYaroslav O. Halchenko\nCenter for Open Neuroscience     http://centerforopenneuroscience.org\nDartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755\nPhone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419\nWWW:   http://www.linkedin.com/in/yarik        \n"}]}