{"thread":{"id":"27190","subject":"[PATCH] fetch: show remote name instead of URL if available","startedAt":"2011-04-26T15:13:27Z","lastAt":"2011-04-26T17:36:26Z","messageCount":3,"participants":["Dan McGee","Junio C Hamano","Drew Northup"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"166383","messageId":"1303830807-21966-1-git-send-email-dpmcgee@gmail.com","threadId":"27190","inReplyTo":null,"subject":"[PATCH] fetch: show remote name instead of URL if available","fromName":"Dan McGee","fromEmail":"dpmcgee@gmail.com","sentAt":"2011-04-26T15:13:27Z","receivedAt":"2011-04-26T15:13:27Z","isPatch":true,"sender":{"key":"dpmcgee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/265817?v=4"},"body":"We often have a name such as 'origin' available; use it if so rather\nthan showing the raw URL.\n\nSigned-off-by: Dan McGee <dpmcgee@gmail.com>\n---\n\nThe old output:\n\n    $ git fetch -v\n    From git://git.kernel.org/pub/scm/git/git\n     = [up to date]      html       -> origin/html\n    ...\n\nVersus the new output:\n\n    $ ./git fetch -v\n    From origin\n     = [up to date]      html       -> origin/html\n    ...\n\nAlternatively, we could do something like\n    From origin (git://git.kernel.org/pub/scm/git/git)\nbut no other command seems to do such a thing. Note that a fetch with a direct\nURL rather than a name will still show the URL as before.\n\nAnother RFC in this is the behavior of `git ls-remote`- it also shows a URL\nwhen we may have a nice name available, so I can resubmit with that modified as\nwell if people agree with the change. The difference is porcelain vs plumbing.\n\n-Dan\n\n builtin/fetch.c |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex f9c41da..01bda5a 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -436,8 +436,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,\n \t\t\t\t REFCOL_WIDTH, *what ? what : \"HEAD\");\n \t\tif (*note) {\n \t\t\tif (verbosity >= 0 && !shown_url) {\n-\t\t\t\tfprintf(stderr, _(\"From %.*s\\n\"),\n-\t\t\t\t\t\turl_len, url);\n+\t\t\t\tif (remote_name)\n+\t\t\t\t\tfprintf(stderr, _(\"From %s\\n\"),\n+\t\t\t\t\t\t\tremote_name);\n+\t\t\t\telse\n+\t\t\t\t\tfprintf(stderr, _(\"From %.*s\\n\"),\n+\t\t\t\t\t\t\turl_len, url);\n \t\t\t\tshown_url = 1;\n \t\t\t}\n \t\t\tif (verbosity >= 0)\n-- \n1.7.5\n"},{"id":"166399","messageId":"7v1v0ogbnn.fsf@alter.siamese.dyndns.org","threadId":"27190","inReplyTo":"1303830807-21966-1-git-send-email-dpmcgee@gmail.com","subject":"Re: [PATCH] fetch: show remote name instead of URL if available","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-26T17:33:48Z","receivedAt":"2011-04-26T17:33:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dan McGee <dpmcgee@gmail.com> writes:\n\n>     $ git fetch -v\n>     From git://git.kernel.org/pub/scm/git/git\n>      = [up to date]      html       -> origin/html\n>     ...\n\nI see this full URL output as a nice reminder of what \"origin\" refers to,\nespecially when you said \"git fetch -v origin\".  This is especially useful\nwhen you are fetching from different locations that house repositories of\nthe same project (e.g. among my multiple git.git working trees on my\nnotebook, some of them fetch from my private, primaty development machine\nand others from public k.org).\n\nChanging this output ...\n\n> Versus the new output:\n>\n>     $ ./git fetch -v\n>     From origin\n\n... this way feels like a regression to me.\n\n> Alternatively, we could do something like\n>     From origin (git://git.kernel.org/pub/scm/git/git)\n\nThat is much less problematic.\n\nBut let's step back a bit.  What problem are you trying to solve?\n\nAre you trying to give a reminder that you are interacting with 'origin'\nwhen you said \"git fetch -v\" without saying where you are fetching from?\nI think that is a good thing to aim for (the same reasoning behind the\ncomment of mine above).  If so, the ideal change from my gut feeling is to\nadd an extra \" (origin)\" at the end, like so:\n\n\tFrom git://git.kernel.org/pub/scm/git/git (origin)\n\nwhen and only when the fetch is done without mentioning any remote\nnickname; iow, \"git fetch -v origin\" or \"git fetch -v git://.../git\" won't\nget the extra \" (origin)\" at the end.\n"},{"id":"166403","messageId":"1303839386.18603.19.camel@drew-northup.unet.maine.edu","threadId":"27190","inReplyTo":"7v1v0ogbnn.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] fetch: show remote name instead of URL if available","fromName":"Drew Northup","fromEmail":"drew.northup@maine.edu","sentAt":"2011-04-26T17:36:26Z","receivedAt":"2011-04-26T17:36:26Z","isPatch":true,"sender":{"key":"drew.northup@maine.edu","avatar":"https://avatars.githubusercontent.com/u/18331571?v=4"},"body":"\nOn Tue, 2011-04-26 at 10:33 -0700, Junio C Hamano wrote:\n> Dan McGee <dpmcgee@gmail.com> writes:\n> \n> >     $ git fetch -v\n> >     From git://git.kernel.org/pub/scm/git/git\n> >      = [up to date]      html       -> origin/html\n> >     ...\n> \n> I see this full URL output as a nice reminder of what \"origin\" refers to,\n> especially when you said \"git fetch -v origin\".  This is especially useful\n> when you are fetching from different locations that house repositories of\n> the same project (e.g. among my multiple git.git working trees on my\n> notebook, some of them fetch from my private, primaty development machine\n> and others from public k.org).\n> \n> Changing this output ...\n> \n> > Versus the new output:\n> >\n> >     $ ./git fetch -v\n> >     From origin\n> \n> ... this way feels like a regression to me.\n> \n> > Alternatively, we could do something like\n> >     From origin (git://git.kernel.org/pub/scm/git/git)\n> \n> That is much less problematic.\n> \n> But let's step back a bit.  What problem are you trying to solve?\n> \n> Are you trying to give a reminder that you are interacting with 'origin'\n> when you said \"git fetch -v\" without saying where you are fetching from?\n> I think that is a good thing to aim for (the same reasoning behind the\n> comment of mine above).  If so, the ideal change from my gut feeling is to\n> add an extra \" (origin)\" at the end, like so:\n> \n> \tFrom git://git.kernel.org/pub/scm/git/git (origin)\n> \n> when and only when the fetch is done without mentioning any remote\n> nickname; iow, \"git fetch -v origin\" or \"git fetch -v git://.../git\" won't\n> get the extra \" (origin)\" at the end.\n\nI was about to compose mail to the same effect, so I'll just agree\ninstead.\n\n-- \n-Drew Northup\n________________________________________________\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"}]}