From: Nguyễn Thái Ngọc Duy Date: Sun, 14 Sep 2008 13:07:58 GMT Subject: [PATCH 09/16] ls-files: apply --deleted on narrow area only Message-ID: <1221397685-27715-10-git-send-email-pclouds@gmail.com> In-Reply-To: <1221397685-27715-9-git-send-email-pclouds@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin-ls-files.c | 2 +- t/t2104-update-index-narrow.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 456d41c..02fa00b 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -260,7 +260,7 @@ static void show_files(struct dir_struct *dir, const char *prefix) if (excluded(dir, ce->name, &dtype) != dir->show_ignored) continue; err = lstat(ce->name, &st); - if (show_deleted && err) + if (show_deleted && err && ce_checkout(ce)) show_ce_entry(tag_removed, ce); if (show_modified && ce_modified(ce, &st, 0)) show_ce_entry(tag_modified, ce); diff --git a/t/t2104-update-index-narrow.sh b/t/t2104-update-index-narrow.sh index 2683929..1a3acdd 100755 --- a/t/t2104-update-index-narrow.sh +++ b/t/t2104-update-index-narrow.sh @@ -25,6 +25,12 @@ test_expect_success 'index is at version 3 after having some no-checkout entries test "$(test-index-version < .git/index)" = 3 ' +test_expect_success 'ls-files --deleted ignores no-checkout entries' ' + rm 1 && + test -z "$(git ls-files --deleted)" && + touch 1 +' + test_expect_success 'update-index --checkout' ' git update-index --checkout 1 sub/1 && test "$(git ls-files)" = "$(git ls-files --narrow-checkout)"' -- 1.6.0.96.g2fad1.dirty