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

Re: [PATCH 5/5] builtin-remote: Make "remote -v" display push urls

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Jun 9, 2009, 16:25 UTC
Message-ID
<36ca99e90906090925q71ed98f4j23336dabbe199bd8@mail.gmail.com>
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:
Show 18 quoted lines
> 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

Show 27 quoted lines
>
> 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
Previous: Junio C HamanoNext: Michael J Gruber
Message 14 of 15 in “Allow push and fetch urls to be different”
  1. 0/5 Allow push and fetch urls to be differentMichael J Gruber, Jun 9, 2009
  2. 1/5 Allow push and fetch urls to be differentMichael J Gruber, Jun 9, 2009
  3. 2/5 t5516: Check pushurl config settingMichael J Gruber, Jun 9, 2009
  4. 3/5 technical/api-remote: Describe new struct remote member pushurlMichael J Gruber, Jun 9, 2009
  5. 4/5 builtin-remote: Show push urls as wellMichael J Gruber, Jun 9, 2009
  6. 5/5 builtin-remote: Make "remote -v" display push urlsMichael J Gruber, Jun 9, 2009
  7. Junio C HamanoJun 9, 2009
  8. Michael J GruberJun 9, 2009
  9. Junio C HamanoJun 9, 2009
  10. 0/5 builtin-remote: Make "remote -v" display push urlsMichael J Gruber, Jun 13, 2009
  11. 4/5 builtin-remote: Show push urls as wellMichael J Gruber, Jun 13, 2009
  12. 5/5 builtin-remote: Make "remote -v" display push urlsMichael J Gruber, Jun 13, 2009
  13. Junio C HamanoJun 14, 2009
  14. Bert WesargJun 9, 2009
  15. Michael J GruberJun 9, 2009

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.