untracked-cache: fix subdirectory handling
commit2e5910f27695b1b24e8a6870940bfac2a03ef0d7
authorDavid Turner <dturner@twopensource.com>
Wed, 19 Aug 2015 13:01:25 +0000 (19 20:01 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Aug 2015 17:40:24 +0000 (19 10:40 -0700)
tree84c5f7ab90fde4b29bbb32f1214bc9e0a9027cc2
parentf178136e688f6eabe09130e79a0c9e2de58928a0
untracked-cache: fix subdirectory handling

Previously, some calls lookup_untracked would pass a full path.  But
lookup_untracked assumes that the portion of the path up to and
including to the untracked_cache_dir has been removed.  So
lookup_untracked would be looking in the untracked_cache for 'foo' for
'foo/bar' (instead of just looking for 'bar').  This would cause
untracked cache corruption.

Instead, treat_directory learns to track the base length of the parent
directory, so that only the last path component is passed to
lookup_untracked.

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c
t/t7063-status-untracked-cache.sh