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

Re: [PATCH] fetch: Print full url in header

From
TMTom Miller <jackerran@gmail.com>
Date
Jan 10, 2014, 03:03 UTC
Message-ID
<20140110030354.GA19887@gmail.com>
In-Reply-To
<xmqqwqi8aph1.fsf@gitster.dls.corp.google.com>
On Thu, Jan 09, 2014 at 12:07:38PM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> 
> Having said all that, the difference between the full URL shown by
> "remote --verbose" (which is used to interact with the remote in
> this repository) and the abbreviated URL (which is shown by "fetch"
> and is designed to be sharable with others with a simple cut&paste)
> matters only when there are a pair of ambiguously configured
> repositories (e.g. there are two repositories "git://host/a.git/"
> and "git://host/a/.git") that serve different things and you are
> debugging the situation.  And to me, "remote --verbose" looks more
> or less a debugging aid, nothing more.  So another alternative that
> may be to leave everything as-is.
> 
> Thanks.

I like the alterantive option of "leave everything as-is", especially after the arguments you've presented. There is still the problem of the logic that has been duplicated. I think it should be put in a function, but if you are ok with leaving it duplicated that is fine by me.

	if (raw_url)
		url = transport_anonymize_url(raw_url);
	else
		url = xstrdup("foreign");
	url_len = strlen(url);
	for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
		;
	url_len = i + 1;
	if (4 < i && !strncmp(".git", url + i - 3, 4))
		url_len = i - 3;

Thanks, Tom Miller

Previous: Junio C Hamano
Message 3 of 3 in “fetch: Print full url in header”
  1. fetch: Print full url in headerTom Miller, Jan 9, 2014
  2. Junio C HamanoJan 9, 2014
  3. Tom MillerJan 10, 2014

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.