git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: David Turner <dturner@twopensource.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC 3/6] http-backend: handle refspec argument
Date: Sat, 16 Apr 2016 21:51:29 -0400	[thread overview]
Message-ID: <CAPig+cRSE-BCPdrSbrCYmTcT6EsabKnekr2GEAbmBsc5=jxnHQ@mail.gmail.com> (raw)
In-Reply-To: <1460747949-3514-4-git-send-email-dturner@twopensource.com>

On Fri, Apr 15, 2016 at 3:19 PM, David Turner <dturner@twopensource.com> wrote:
> Allow clients to pass a "refspec" parameter through to upload-pack;
> upload-pack will only advertise refs which match that refspec.
>
> Signed-off-by: David Turner <dturner@twopensource.com>
> ---
> diff --git a/http-backend.c b/http-backend.c
> @@ -465,6 +466,14 @@ static void get_info_refs(char *arg)
>                 argv_array_push(&argv, "--stateless-rpc");
>                 argv_array_push(&argv, "--advertise-refs");
>
> +               refspec = get_parameter("refspec");
> +               if (refspec) {
> +                       struct strbuf interesting_refs = STRBUF_INIT;
> +                       strbuf_addstr(&interesting_refs, "--interesting-refs=");
> +                       strbuf_addstr(&interesting_refs, refspec);
> +                       argv_array_push(&argv, interesting_refs.buf);
> +                       strbuf_release(&interesting_refs);
> +               }

    if (refspec)
        argv_array_pushf(&interesting_refs,
            "--interesting-refs=%s", refspec);

>                 argv_array_push(&argv, ".");
>                 run_service(argv.argv, 0);
>                 argv_array_clear(&argv);
> @@ -841,6 +905,19 @@ int main(int argc, char **argv)
> +               if (starts_with(arg, "--interesting-refs=")) {
> +                       struct string_list_item *item;
> +
> +                       string_list_split(&interesting_refspecs, arg + 19,
> +                                         ' ', -1);
> +                       for_each_string_list_item(item, &interesting_refspecs) {
> +                               if (check_refname_format(item->string,
> +                                                        REFNAME_REFSPEC_PATTERN))
> +                                       die("invalid refspec %s", item->string);
> +                               item->util = make_refspec_data(item->string);
> +                       }
> +                       continue;
> +               }

Is this leaking the string list?

>                 if (!strcmp(arg, "--stateless-rpc")) {
>                         stateless_rpc = 1;
>                         continue;
> --
> 2.4.2.767.g62658d5-twtrsrc

  reply	other threads:[~2016-04-17  1:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 19:19 [PATCH/RFC 0/6] fetch with refspec David Turner
2016-04-15 19:19 ` [PATCH/RFC 1/6] http-backend: use argv_array functions David Turner
2016-04-18 18:34   ` Junio C Hamano
2016-04-19 19:11     ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 2/6] remote-curl.c: fix variable shadowing David Turner
2016-04-18 18:35   ` Junio C Hamano
2016-04-19 19:14     ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 3/6] http-backend: handle refspec argument David Turner
2016-04-17  1:51   ` Eric Sunshine [this message]
2016-04-19 18:57     ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 4/6] transport: add refspec list parameters to functions David Turner
2016-04-18 18:45   ` Junio C Hamano
2016-04-19  7:14     ` Jeff King
2016-04-19 18:04       ` Stefan Beller
2016-04-19 20:55       ` Junio C Hamano
2016-04-19 21:40       ` David Turner
2016-04-19 23:22         ` Jeff King
2016-04-19 23:43           ` David Turner
2016-04-20  1:17             ` Jeff King
2016-04-20 20:46               ` David Turner
2016-04-20 20:57                 ` Jeff King
2016-04-25 16:44                   ` David Turner
2016-04-25 22:10                     ` Stefan Beller
2016-04-27  3:59                       ` Stefan Beller
2016-04-27  4:11                         ` Jeff King
2016-04-27 15:07                           ` Junio C Hamano
2016-04-29 23:05                         ` David Turner
2016-04-29 23:12                           ` Stefan Beller
2016-04-19 19:31     ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 5/6] fetch: pass refspec to http server David Turner
2016-04-17  2:33   ` Eric Sunshine
2016-04-19 21:25     ` David Turner
2016-04-15 19:19 ` [PATCH/RFC 6/6] clone: send refspec for single-branch clones David Turner
2016-04-17  2:36   ` Eric Sunshine
2016-04-19 21:24     ` David Turner
2016-04-15 19:30 ` [PATCH/RFC 0/6] fetch with refspec Stefan Beller

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='CAPig+cRSE-BCPdrSbrCYmTcT6EsabKnekr2GEAbmBsc5=jxnHQ@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    /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).