difference in behavior bw ls-files and ls-tree on paths in submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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        



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux