Re: [PATCH 2/2] resolve_gitlink_ref: ignore non-repository paths
From: Jeff King <hidden>
Date: 2016-06-15 23:07:51
On Fri, Jan 22, 2016 at 05:29:30PM -0500, Jeff King wrote:
quoted hunk ↗ jump to hunk
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index 88be904..c525656 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh@@ -65,6 +65,13 @@ test_expect_success '--no-empty-directory hides empty directory' ' test_cmp expected3 output ' +test_expect_success 'ls-files --others handles non-submodule .git' ' + mkdir not-a-submodule && + echo foo >not-a-submodule/.git && + git ls-files -o >output && + test_cmp expected1 output +'
BTW, I scratched my head about why I was able to use "expected1" here without having to add "not-a-submodule" to it. But the answer is that the directory itself does not get mentioned (it is not a file!), and we seem to always exclude ".git" paths entirely. I'm not sure if that's the best thing in every case (what if you have precious content in a ".git" file?), but this does behave exactly as a valid ".git" would with an empty HEAD ref. So I think it's a reasonable behavior in practice. -Peff