git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: git <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Ben Peart <Ben.Peart@microsoft.com>,
	Jonathan Tan <jonathantanmy@google.com>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	Mike Hommey <mh@glandium.org>,
	Lars Schneider <larsxschneider@gmail.com>,
	Eric Wong <e@80x24.org>,
	Christian Couder <chriscool@tuxfamily.org>,
	Jeff Hostetler <jeffhost@microsoft.com>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v2 0/9] Introducing remote ODBs
Date: Sat, 30 Jun 2018 10:39:12 +0200	[thread overview]
Message-ID: <CAP8UFD2GEUERdMXgEO2ZA4L4ZZa=WnZ14EUHM1be-rsmgDSV0g@mail.gmail.com> (raw)
In-Reply-To: <20180630083542.20347-1-chriscool@tuxfamily.org>

On Sat, Jun 30, 2018 at 10:35 AM, Christian Couder
<christian.couder@gmail.com> wrote:

> Changes compared to V1 of this patch series
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>   - fix tests failures
>   - error out when more than one "odb.<name>.promisorremote" exist
>     with the same <name>

Here is the diff with V1:

diff --git a/remote-odb.c b/remote-odb.c
index 5b9d1930b5..eb580ca513 100644
--- a/remote-odb.c
+++ b/remote-odb.c
@@ -21,6 +21,17 @@ static struct odb_helper
*find_or_create_helper(const char *name, int len)
     return o;
 }

+static struct odb_helper *do_find_odb_helper(const char *remote)
+{
+    struct odb_helper *o;
+
+    for (o = helpers; o; o = o->next)
+        if (o->remote && !strcmp(o->remote, remote))
+            return o;
+
+    return NULL;
+}
+
 static int remote_odb_config(const char *var, const char *value, void *data)
 {
     struct odb_helper *o;
@@ -33,8 +44,22 @@ static int remote_odb_config(const char *var, const
char *value, void *data)

     o = find_or_create_helper(name, namelen);

-    if (!strcmp(subkey, "promisorremote"))
-        return git_config_string(&o->remote, var, value);
+    if (!strcmp(subkey, "promisorremote")) {
+        const char *remote;
+        int res = git_config_string(&remote, var, value);
+
+        if (res)
+            return res;
+
+        if (do_find_odb_helper(remote))
+            return error(_("when parsing config key '%s' "
+                       "helper for remote '%s' already exists"),
+                     var, remote);
+
+        o->remote = remote;
+
+        return 0;
+    }
     if (!strcmp(subkey, "partialclonefilter"))
         return git_config_string(&o->partial_clone_filter, var, value);

@@ -71,11 +96,7 @@ struct odb_helper *find_odb_helper(const char *remote)
     if (!remote)
         return helpers;

-    for (o = helpers; o; o = o->next)
-        if (!strcmp(o->remote, remote))
-            return o;
-
-    return NULL;
+    return do_find_odb_helper(remote);
 }

 int has_remote_odb(void)
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index b29c0d3d39..9d513ebf57 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -23,10 +23,10 @@ promise_and_delete () {
     delete_object repo "$HASH"
 }

-test_expect_success 'extensions.partialclone without filter' '
+test_expect_success 'promisor remote without filter' '
     test_create_repo server &&
     git clone --filter="blob:none" "file://$(pwd)/server" client &&
-    git -C client config --unset core.partialclonefilter &&
+    git -C client config --unset odb.origin.partialclonefilter &&
     git -C client fetch origin
 '

diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index a4fe6508bd..0c47599568 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -285,7 +285,7 @@ test_expect_success 'partial fetch' '
     rm -rf client "$(pwd)/trace" &&
     git init client &&
     SERVER="file://$(pwd)/server" &&
-    test_config -C client extensions.partialClone "$SERVER" &&
+    test_config -C client odb.magic.promisorRemote "$SERVER" &&

     GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
         fetch --filter=blob:none "$SERVER" master:refs/heads/other &&

      parent reply	other threads:[~2018-06-30  8:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30  8:35 [PATCH v2 0/9] Introducing remote ODBs Christian Couder
2018-06-30  8:35 ` [PATCH v2 1/9] fetch-object: make functions return an error code Christian Couder
2018-06-30  8:35 ` [PATCH v2 2/9] Add initial remote odb support Christian Couder
2018-06-30  8:35 ` [PATCH v2 3/9] remote-odb: implement remote_odb_get_direct() Christian Couder
2018-06-30  8:35 ` [PATCH v2 4/9] remote-odb: implement remote_odb_get_many_direct() Christian Couder
2018-06-30  8:35 ` [PATCH v2 5/9] remote-odb: add remote_odb_reinit() Christian Couder
2018-06-30  8:35 ` [PATCH v2 6/9] Use remote_odb_get_direct() and has_remote_odb() Christian Couder
2018-06-30  8:35 ` [PATCH v2 7/9] Use odb.origin.partialclonefilter instead of core.partialclonefilter Christian Couder
2018-06-30  8:35 ` [PATCH v2 8/9] t0410: test fetching from many promisor remotes Christian Couder
2018-06-30  8:35 ` [PATCH v2 9/9] Documentation/config: add odb.<name>.promisorRemote Christian Couder
2018-06-30  8:39 ` Christian Couder [this message]

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='CAP8UFD2GEUERdMXgEO2ZA4L4ZZa=WnZ14EUHM1be-rsmgDSV0g@mail.gmail.com' \
    --to=christian.couder@gmail.com \
    --cc=Ben.Peart@microsoft.com \
    --cc=chriscool@tuxfamily.org \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=jonathantanmy@google.com \
    --cc=larsxschneider@gmail.com \
    --cc=mh@glandium.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.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).