public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Stefan Beller <sbeller@google•com>
Cc: j6t@kdbg•org, Johannes.Schindelin@gmx•de, git@vger•kernel.org,
	venv21@gmail•com, dennis@kaarsemaker•net, jrnieder@gmail•com
Subject: Re: [PATCH] submodule--helper: normalize funny urls
Date: Mon, 17 Oct 2016 15:49:13 -0700	[thread overview]
Message-ID: <xmqqbmyisiae.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161017221623.7299-1-sbeller@google.com> (Stefan Beller's message of "Mon, 17 Oct 2016 15:16:23 -0700")

Stefan Beller <sbeller@google•com> writes:

> +static void strip_url_ending(char *url, size_t *_len)
> +{
> +	int check_url_stripping = 1;
> +	size_t len = _len ? *_len : strlen(url);
> +
> +	while (check_url_stripping) {
> +		check_url_stripping = 0;
> +		if (is_dir_sep(url[len-2]) && url[len-1] == '.') {

This is "strip /. at the end" it seems.

Does anything in the loop control guarantees 2 <= len at this point?

> +			url[len-2] = '\0';
> +			len -= 2;
> +			check_url_stripping = 1;
> +		}
> +
> +		if (is_dir_sep(url[len-1])) {

This is "strip / at the end" it seems.

Does anything in the loop control guarantees 1 <= len at this point?

> +			url[len-1] = '\0';
> +			len--;
> +			check_url_stripping = 1;
> +		}
> +	}

  reply	other threads:[~2016-10-17 22:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 22:16 [PATCH] submodule--helper: normalize funny urls Stefan Beller
2016-10-17 22:49 ` Junio C Hamano [this message]
2016-10-17 22:50   ` Stefan Beller
2016-10-18 11:23     ` Johannes Schindelin
2016-10-18 17:15   ` Junio C Hamano
2016-10-18 17:17     ` Stefan Beller
2016-10-18 17:51       ` Junio C Hamano
2016-10-18 15:24 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2016-10-18 17:52 Stefan Beller
2016-10-18 19:49 ` Junio C Hamano

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=xmqqbmyisiae.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=dennis@kaarsemaker$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=sbeller@google$(echo .)com \
    --cc=venv21@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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