Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Junio C Hamano
Stefan Beller writes: > Some users may rely on this by always cloning with '/.' and having > an additional '../' in the relative path for the submodule, and this > patch breaks them. So why introduce this patch? > > The fix in c12922024 (submodule: ignore trailing slash on superproject > URL, 201

[PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Stefan Beller
The remote URL for the submodule can be specified relative to the URL of the superproject in .gitmodules. A top-level git://site.xz/toplevel.git can specify in its .gitmodules [submodule "sub"] url = ../submodule.git path = sub to say that git://site.xz/su

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Junio C Hamano
Stefan Beller writes: > for(;;) { > > here ? (this code would not need a variable, and > for wins over while: > $ git grep "while (1)" |wc -l > 107 > $ git grep "for (;;)" |wc -l > 128 > ) I dunno; the numbers tells me there is no strong preference by wide margin either way. I am not sure if th

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Stefan Beller
On Tue, Oct 18, 2016 at 10:15 AM, Junio C Hamano wrote: > > I also somehow find the "check-url-stripping" variable ugly. > > while (URL still has something that could be stripped) { for(;;) { here ? (this code would not need a variable, and for wins over while: $ git grep "while (1)" |wc

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Junio C Hamano
Junio C Hamano writes: > Stefan Beller 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; >> +

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Junio C Hamano
Stefan Beller writes: > Currently a URL for the superproject ending in > > (A).../path/to/dir > (B).../path/to/dir/ > (C).../path/to/dir/. > (D).../path/to/dir/./. > (E).../path/to/dir/.///.//. > > is treated the same in (A) and (B), but (C, D, E) are different. You may know

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-18 Thread Johannes Schindelin
Hi Stefan, On Mon, 17 Oct 2016, Stefan Beller wrote: > On Mon, Oct 17, 2016 at 3:49 PM, Junio C Hamano wrote: > > Stefan Beller writes: > > > >> +static void strip_url_ending(char *url, size_t *_len) > >> +{ > >> + int check_url_stripping = 1; > >> + size_t len = _len ? *_len : strlen(u

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-17 Thread Stefan Beller
On Mon, Oct 17, 2016 at 3:49 PM, Junio C Hamano wrote: > Stefan Beller 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) { >> + che

Re: [PATCH] submodule--helper: normalize funny urls

2016-10-17 Thread Junio C Hamano
Stefan Beller 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]) &

[PATCH] submodule--helper: normalize funny urls

2016-10-17 Thread Stefan Beller
Currently a URL for the superproject ending in (A).../path/to/dir (B).../path/to/dir/ (C).../path/to/dir/. (D).../path/to/dir/./. (E).../path/to/dir/.///.//. is treated the same in (A) and (B), but (C, D, E) are different. We never produce the URLs in (C,D,E) ourselves, they