Re: [GSoC] [PATCH v4 4/8] dir: libify and export helper functions from clone.c
- From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
- Date
- Aug 10, 2021, 17:53 UTC
- Message-ID
- <68bb457b-9575-c2a1-6d51-fc7cd85a50b7@gmail.com>
- In-Reply-To
- <m21r73avvx.fsf@gmail.com>
On 09/08/21 1:32 pm, Atharva Raykar wrote:
Show 32 quoted lines
> > Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes: > >> On 07/08/21 12:46 pm, Atharva Raykar wrote: >>>> [ ... ] >>> >>> diff --git a/dir.h b/dir.h >>> index b3e1a54a97..a4a6fd7371 100644 >>> --- a/dir.h >>> +++ b/dir.h >>> @@ -453,6 +453,16 @@ static inline int is_dot_or_dotdot(const char *name) >>> int is_empty_dir(const char *dir); >>> +/* >>> + * Retrieve the "humanish" basename of the given Git URL. >>> + * >>> + * For example: >>> + * /path/to/repo.git => "repo" >>> + * host.xz.foo/.git => "foo" >>> + */ >> >> Are you sure about the examples here? I just tried and ... >> >> - '/path/to/repo.git' gave me 'repo' like you said >> >> .. but .. >> >> - 'host.xz.foo/.git' gives me 'host.xz.foo' instead of 'foo'. >> I think you meant to have 'host.xz/foo.git' in the example. > > Yikes! I meant 'host.xz:foo/.git'. That should give us 'foo'. Thanks for > the correction. >
Interesting. I've usually seen host.xz:foo like syntax in HTTP URLs. For instance,
http://host.xz:4000/bar.baz.git
`git_url_basename` returns `bar.baz` for the above.
I wonder what real-world URL has a syntax like 'host.xz:foo/.git' for which 'foo' would be an appropriate basename to return. Does a real-world URL of this form exist? Or is this just cooked up to demonstrate the basename that would be returned for a hypothetical URL like this?
-- Sivaraam