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

Re: [PATCH] git-submodules.sh: fix '/././' path normalization

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 2, 2015, 20:02 UTC
Message-ID
<54CFD7C4.4030000@web.de>
In-Reply-To
<1422630843-9559-1-git-send-email-ps@pks.im>
Am 30.01.2015 um 16:14 schrieb Patrick Steinhardt:
> When we add a new submodule the path of the submodule is being normalized. We
> fail to normalize multiple adjacent '/./', though. Thus 'path/to/././submodule'
> will become 'path/to/./submodule' where it should be 'path/to/submodule'
> instead.
Thanks, nicely done and fixes the issue you noticed: Ack from me.
Show 48 quoted lines
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>   git-submodule.sh           |  2 +-
>   t/t7400-submodule-basic.sh | 17 +++++++++++++++++
>   2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 9245abf..36797c3 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -423,7 +423,7 @@ cmd_add()
>   		sed -e '
>   			s|//*|/|g
>   			s|^\(\./\)*||
> -			s|/\./|/|g
> +			s|/\(\./\)*|/|g
>   			:start
>   			s|\([^/]*\)/\.\./||
>   			tstart
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 7c88245..5811a98 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
>   	test_cmp empty untracked
>   '
>
> +test_expect_success 'submodule add with /././ in path' '
> +	echo "refs/heads/master" >expect &&
> +	>empty &&
> +
> +	(
> +		cd addtest &&
> +		git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
> +		git submodule init
> +	) &&
> +
> +	rm -f heads head untracked &&
> +	inspect addtest/dotslashdotsubmod/frotz ../../.. &&
> +	test_cmp expect heads &&
> +	test_cmp expect head &&
> +	test_cmp empty untracked
> +'
> +
>   test_expect_success 'submodule add with // in path' '
>   	echo "refs/heads/master" >expect &&
>   	>empty &&
>
Previous: Patrick Steinhardt
Message 2 of 2 in “git-submodules.sh: fix '/././' path normalization”
  1. git-submodules.sh: fix '/././' path normalizationPatrick Steinhardt, Jan 30, 2015
  2. Jens LehmannFeb 2, 2015

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.