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

Re: [PATCH 1/3] builtin/fetch.c: Add pretty_url() and print_url()

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2013, 21:47 UTC
Message-ID
<xmqq8uvhhlwg.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1387401776-30994-1-git-send-email-jackerran@gmail.com>
Tom Miller <jackerran@gmail.com> writes:
Show 21 quoted lines
> In order to fix branchname DF conflicts during `fetch --prune`, the way
> the header is output to the screen needs to be refactored. Here is an
> exmaple of the output with the line in question denoted by '>':
>
> 	$ git fetch --prune --dry-run upstream
>>	From https://github.com/git/git
> 	   a155a5f..5512ac5  maint      -> upstream/maint
> 	   d7aced9..7794a68  master     -> upstream/master
> 	   523f7c4..3e57c29  next       -> upstream/next
> 	 + 462f102...0937cdf pu         -> upstream/pu  (forced update)
> 	   e24105a..5d352bc  todo       -> upstream/todo
> 	 * [new tag]         v1.8.5.2   -> v1.8.5.2
> 	 * [new tag]         v1.8.5.2   -> v1.8.5.2
>
> pretty_url():
> This function when passed a transport url will anonymize the transport
> of the url. It will strip a trailing '/'. It will also strip a trailing
> '.git'. It will return the newly formated url for use. I do not believe
> there is a need for stripping the trailing '/' and '.git' from a url,
> but it was already there and I wanted to make as little changes as
> possible.

OK. I tend to agree that stripping the trailing part is probably not a good idea and we would want to remove that but that definitely should be done as a separate step, or even as a separate series on top of this one.

Show 5 quoted lines
> print_url():
> This function will convert a transport url to a pretty url using
> pretty_url(). Then it will print out the pretty url to stderr as
> indicated above in the example output. It uses a global variable
> named "gshown_url' to prevent this header for being printed twice.

Gaah. What is that 'g' doing there? Please don't do that meaningless naming.

I do not think the change to introduce such a global variable belongs to this refactoring step. The current caller can decide itself if it called that function, and if you are going to introduce new callers in later steps, they can coordinate among themselves, no?

Previous: Junio C HamanoNext: Tom Miller
Message 9 of 13 in “builtin/fetch.c: Add pretty_url() and print_url()”
  1. 1/3 builtin/fetch.c: Add pretty_url() and print_url()Tom Miller, Dec 18, 2013
  2. 2/3 fetch --prune: Always print header urlTom Miller, Dec 18, 2013
  3. 3/3 fetch --prune: Repair branchname DF conflictsTom Miller, Dec 18, 2013
  4. Junio C HamanoDec 18, 2013
  5. Tom MillerDec 19, 2013
  6. Junio C HamanoDec 19, 2013
  7. Jeff KingDec 19, 2013
  8. Junio C HamanoDec 19, 2013
  9. Junio C HamanoDec 18, 2013
  10. Tom MillerDec 19, 2013
  11. Thomas MillerDec 19, 2013
  12. 1/2 fetch --prune: Always print header urlTom Miller, Dec 19, 2013
  13. 2/2 fetch --prune: Run prune before fetchingTom Miller, Dec 19, 2013

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.