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

Re: [PATCH v2 0/9] Introducing remote ODBs

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 30, 2018, 08:39 UTC
Message-ID
<CAP8UFD2GEUERdMXgEO2ZA4L4ZZa=WnZ14EUHM1be-rsmgDSV0g@mail.gmail.com>
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:

Show 6 quoted lines
> 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 &&
Previous: Christian Couder
Message 11 of 11 in “Introducing remote ODBs”
  1. 0/9 Introducing remote ODBsChristian Couder, Jun 30, 2018
  2. 1/9 fetch-object: make functions return an error codeChristian Couder, Jun 30, 2018
  3. 2/9 Add initial remote odb supportChristian Couder, Jun 30, 2018
  4. 3/9 remote-odb: implement remote_odb_get_direct()Christian Couder, Jun 30, 2018
  5. 4/9 remote-odb: implement remote_odb_get_many_direct()Christian Couder, Jun 30, 2018
  6. 5/9 remote-odb: add remote_odb_reinit()Christian Couder, Jun 30, 2018
  7. 6/9 Use remote_odb_get_direct() and has_remote_odb()Christian Couder, Jun 30, 2018
  8. 7/9 Use odb.origin.partialclonefilter instead of core.partialclonefilterChristian Couder, Jun 30, 2018
  9. 9/9 Documentation/config: add odb.<name>.promisorRemoteChristian Couder, Jun 30, 2018
  10. 8/9 t0410: test fetching from many promisor remotesChristian Couder, Jun 30, 2018
  11. Christian CouderJun 30, 2018

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.