git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 5/5] builtin-remote: Make "remote -v" display push urls
Date: Tue, 9 Jun 2009 18:25:41 +0200	[thread overview]
Message-ID: <36ca99e90906090925q71ed98f4j23336dabbe199bd8@mail.gmail.com> (raw)
In-Reply-To: <1244563298-15479-6-git-send-email-git@drmicha.warpmail.net>

Hi,

On Tue, Jun 9, 2009 at 18:01, Michael J Gruber<git@drmicha.warpmail.net> wrote:
> Currently, "remote -v" simply lists all urls so that one has to remember
> that only the first one is used for fetches, and all are used for
> pushes.
>
> Change this so that the role of an url is displayed in parentheses, and
> also display push urls.
>
> Example with "mjg" having 1 url and 1 pushurl, "origin" having 3 urls,
> sb having 1 url:
>
> mjg     git://repo.or.cz/git/mjg.git (fetch)
> mjg     repoor:/srv/git/git/mjg.git (push)
> origin  git://repo.or.cz/git.git (fetch)
> origin  git://repo.or.cz/git.git (push)
> origin  git://git2.kernel.org/pub/scm/git/git.git (push)
> origin  git://repo.or.cz/alt-git.git (push)
> sb      git://repo.or.cz/git/sbeyer.git (fetch)
> sb      git://repo.or.cz/git/sbeyer.git (push)

Wouldn't it be more readable if push|fetch comes first?

mjg     (fetch) git://repo.or.cz/git/mjg.git
mjg     (push)  repoor:/srv/git/git/mjg.git
origin  (fetch) git://repo.or.cz/git.git
origin  (push)  git://repo.or.cz/git.git
origin  (push)  git://git2.kernel.org/pub/scm/git/git.git
origin  (push)  git://repo.or.cz/alt-git.git
sb      (fetch) git://repo.or.cz/git/sbeyer.git
sb      (push)  git://repo.or.cz/git/sbeyer.git

And how about to print only one line for (url_nr == 1 && pushurl_nr == 0):

mjg     (fetch) git://repo.or.cz/git/mjg.git
mjg     (push)  repoor:/srv/git/git/mjg.git
origin  (fetch) git://repo.or.cz/git.git
origin  (push)  git://repo.or.cz/git.git
origin  (push)  git://git2.kernel.org/pub/scm/git/git.git
origin  (push)  git://repo.or.cz/alt-git.git
sb              git://repo.or.cz/git/sbeyer.git

>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
>  builtin-remote.c |   27 +++++++++++++++++++++++----
>  1 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/builtin-remote.c b/builtin-remote.c
> index b350b18..80b2536 100644
> --- a/builtin-remote.c
> +++ b/builtin-remote.c
> @@ -1276,14 +1276,31 @@ static int update(int argc, const char **argv)
>  static int get_one_entry(struct remote *remote, void *priv)
>  {
>        struct string_list *list = priv;
> +       const char **url;
> +       int i, url_nr;
> +       void **utilp;
>
>        if (remote->url_nr > 0) {
> -               int i;
> -
> -               for (i = 0; i < remote->url_nr; i++)
> -                       string_list_append(remote->name, list)->util = (void *)remote->url[i];
> +               utilp = &(string_list_append(remote->name, list)->util);
> +               *utilp = malloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
> +               strcpy((char *) *utilp, remote->url[0]);
> +               strcat((char *) *utilp, " (fetch)");
How about using struct strbuf?

Bert

  parent reply	other threads:[~2009-06-09 16:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 16:01 [PATCH 0/5] Allow push and fetch urls to be different Michael J Gruber
2009-06-09 16:01 ` [PATCH 1/5] " Michael J Gruber
2009-06-09 16:01   ` [PATCH 2/5] t5516: Check pushurl config setting Michael J Gruber
2009-06-09 16:01     ` [PATCH 3/5] technical/api-remote: Describe new struct remote member pushurl Michael J Gruber
2009-06-09 16:01       ` [PATCH 4/5] builtin-remote: Show push urls as well Michael J Gruber
2009-06-09 16:01         ` [PATCH 5/5] builtin-remote: Make "remote -v" display push urls Michael J Gruber
2009-06-09 16:25           ` Junio C Hamano
2009-06-09 17:47             ` Michael J Gruber
2009-06-09 18:30               ` Junio C Hamano
2009-06-13 16:29                 ` [PATCHv2 0/5] " Michael J Gruber
2009-06-13 16:29                   ` [PATCHv2 4/5] builtin-remote: Show push urls as well Michael J Gruber
2009-06-13 16:29                     ` [PATCHv2 5/5] builtin-remote: Make "remote -v" display push urls Michael J Gruber
2009-06-14  5:54                       ` Junio C Hamano
2009-06-09 16:25           ` Bert Wesarg [this message]
2009-06-09 18:07             ` [PATCH " Michael J Gruber

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36ca99e90906090925q71ed98f4j23336dabbe199bd8@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@drmicha.warpmail.net \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).