git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] resolve_gitlink_ref: ignore non-repository paths

From
Jeff King <peff@peff.net>
Date
Jan 22, 2016, 22:31 UTC
Message-ID
<20160122223154.GA15635@sigill.intra.peff.net>
In-Reply-To
<20160122222930.GB15560@sigill.intra.peff.net>
On Fri, Jan 22, 2016 at 05:29:30PM -0500, Jeff King wrote:
Show 14 quoted lines
> 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
Previous: Jeff KingNext: Stefan Beller
Message 6 of 9 in “Minor bug, git ls-files -o aborts because of broken submodules”
  1. Duy NguyenJan 22, 2016
  2. Jeff KingJan 22, 2016
  3. Jeff KingJan 22, 2016
  4. 1/2 clean: make is_git_repository a public functionJeff King, Jan 22, 2016
  5. 2/2 resolve_gitlink_ref: ignore non-repository pathsJeff King, Jan 22, 2016
  6. Jeff KingJan 22, 2016
  7. Stefan BellerJan 22, 2016
  8. Jeff KingJan 22, 2016
  9. Andreas KreyJan 25, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.