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

Re: [PATCH 2/2] submodule: Tolerate auto/safecrlf when adding .gitmodules

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jun 20, 2012, 17:52 UTC
Message-ID
<4FE20DD3.6040607@web.de>
In-Reply-To
<eebc8b3692f8fcb95cf75278f7c9f9982e8f2cd6.1340202515.git.brad.king@kitware.com>
Am 20.06.2012 16:43, schrieb Brad King:
> Temporarily disable 'core.safecrlf' to add '.gitmodules' so that
> 'git add' does not reject the LF newlines we write to the file
> even if both 'core.autocrlf' and 'core.safecrlf' are enabled.
> This fixes known breakage tested in t7400-submodule-basic.

Hmm, I have no objections against the intention of the patch. But as I understand it this message will reoccur when the user e.g. edits the .gitmodules file later with any editor who just writes lfs and adds it.

I don't know terribly much about crlf support but maybe flagging the .gitmodules file in .gitattributes would be a better solution here? Opinions?

Show 33 quoted lines
> Signed-off-by: Brad King <brad.king@kitware.com>
> ---
>  git-submodule.sh           |    2 +-
>  t/t7400-submodule-basic.sh |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 5c61ae2..ed9a54a 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -303,7 +303,7 @@ Use -f if you really want to add it." >&2
>  
>  	git config -f .gitmodules submodule."$sm_path".path "$sm_path" &&
>  	git config -f .gitmodules submodule."$sm_path".url "$repo" &&
> -	git add --force .gitmodules ||
> +	git -c core.safecrlf=false add --force .gitmodules ||
>  	die "$(eval_gettext "Failed to register submodule '\$sm_path'")"
>  }
>  
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 5eaeb04..9a4da9b 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -99,7 +99,7 @@ test_expect_success 'submodule add' '
>  	test_cmp empty untracked
>  '
>  
> -test_expect_failure 'submodule add with core.autocrlf and core.safecrlf' '
> +test_expect_success 'submodule add with core.autocrlf and core.safecrlf' '
>  	(
>  		cd addtest-crlf &&
>  		git config core.autocrlf true &&
> 
Previous: Brad KingNext: Brad King
Message 4 of 12 in “submodule add + autocrlf + safecrlf”
  1. 0/2 submodule add + autocrlf + safecrlfBrad King, Jun 20, 2012
  2. 1/2 submodule: Demonstrate failure to add with auto/safecrlfBrad King, Jun 20, 2012
  3. 2/2 submodule: Tolerate auto/safecrlf when adding .gitmodulesBrad King, Jun 20, 2012
  4. Jens LehmannJun 20, 2012
  5. Brad KingJun 20, 2012
  6. Jens LehmannJun 20, 2012
  7. Jeff KingJun 20, 2012
  8. Junio C HamanoJun 20, 2012
  9. Jens LehmannJun 21, 2012
  10. Junio C HamanoJun 20, 2012
  11. Brad KingJun 20, 2012
  12. Junio C HamanoJun 20, 2012

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.