From: Tom Miller <jackerran@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] builtin/fetch.c: Add pretty_url() and print_url()
Date: Wed, 18 Dec 2013 19:18:17 -0600 [thread overview]
Message-ID: <20131219011817.GA31924@gmail.com> (raw)
In-Reply-To: <xmqq8uvhhlwg.fsf@gitster.dls.corp.google.com>
On Wed, Dec 18, 2013 at 3:47 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Tom Miller <jackerran@gmail.com> writes:
>
>> 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.
I think that removing the trailing part will greatly reduce the complexity
to the point were it is unnecessary to have pretty_url(). My goal with
extracting this function is to isolate the complexity of formatting the
url to a single spot. I am thinking along the lines of the following
commit order:
1. Remove the "remove trailing part"
2. Add print_url()
3. Always print url when pruning
4. Reverse order of prune and fetch
>> 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 am not familiar with C conventions and I was trying to stay consistent.
I saw other global variables starting with 'g' and made an assumption.
It will use the original name in the upcoming patches.
> 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?
I agree, there is no reason for introducing it in this step. Thanks for
pointing that out.
next prev parent reply other threads:[~2013-12-19 1:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 21:22 [PATCH 1/3] builtin/fetch.c: Add pretty_url() and print_url() Tom Miller
2013-12-18 21:22 ` [PATCH 2/3] fetch --prune: Always print header url Tom Miller
2013-12-18 21:22 ` [PATCH 3/3] fetch --prune: Repair branchname DF conflicts Tom Miller
2013-12-18 21:54 ` Junio C Hamano
2013-12-19 1:48 ` Tom Miller
2013-12-19 6:28 ` Junio C Hamano
2013-12-19 11:44 ` Jeff King
2013-12-19 19:34 ` Junio C Hamano
2013-12-18 21:47 ` [PATCH 1/3] builtin/fetch.c: Add pretty_url() and print_url() Junio C Hamano
2013-12-19 1:18 ` Tom Miller [this message]
2013-12-19 17:41 ` Thomas Miller
2013-12-19 22:57 ` [PATCH V2 1/2] fetch --prune: Always print header url Tom Miller
2013-12-19 22:57 ` [PATCH V2 2/2] fetch --prune: Run prune before fetching Tom Miller
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=20131219011817.GA31924@gmail.com \
--to=jackerran@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.