builtin/fetch.c: Add pretty_url() and print_url()

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.

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.

Signed-off-by: Tom Miller <jackerran@gmail.com>
fetch --prune: Always print header url

If fetch --prune is run with no new refs to fetch, but it has refs
to prune. Then, the header url is not printed as it would if there were
new refs to fetch. the following is example output showing this
behavior:

$ git fetch --prune --dry-run origin
 x [deleted]         (none)     -> origin/world

After this patch the output of fetch --prune should look like this:

$ git fetch --prune --dry-run origin
From https://github.com/git/git
 x [deleted]         (none)     -> origin/test

Signed-off-by: Tom Miller <jackerran@gmail.com>
fetch --prune: Repair branchname DF conflicts

When a branchname DF conflict occurs during a fetch, --prune should
be able to fix it. When fetching with --prune, the fetching process
happens before pruning causing the branchname DF conflict to persist
and report an error. This patch prunes before fetching, thus
correcting DF conflicts during a fetch.

Signed-off-by: Tom Miller <jackerran@gmail.com>
Tested-by: Thomas Rast <tr@thomasrast.ch>