git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] git-submodules.sh: fix '/././' path normalization
Date: Mon, 02 Feb 2015 21:02:12 +0100	[thread overview]
Message-ID: <54CFD7C4.4030000@web.de> (raw)
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.

> 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 &&
>

      reply	other threads:[~2015-02-02 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 15:14 [PATCH] git-submodules.sh: fix '/././' path normalization Patrick Steinhardt
2015-02-02 20:02 ` Jens Lehmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CFD7C4.4030000@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).