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

[PATCH v6 0/3] bundle-uri: do not die on unresolvable relative URIs

From
AGAniket Gupta <aniketgupta3001@gmail.com>
Date
Dec 2, 2026, 20:46 UTC
Message-ID
<20261202204608.97770-1-aniketgupta3001@gmail.com>
In-Reply-To
<20261126115803.30015-1-aniketgupta3001@gmail.com>

A bundle list can contain a relative URI that cannot be resolved and one such entry can result in the entire clone dying. This series lets the bundle code report it and the clone carry on.

Changes in v6:
 * Patch 3: also drop the bundle when a uri key has no value, so that
   both cases are handled the same way (Patrick). The code that drops a
   bundle is now a small helper as it is used twice.
Changes in v5:
 * Patch 3: drop the bundle from the list when its URI cannot be
   resolved. A list that a server advertises no longer reports that
   bundle a second time as having no uri (Junio). Added a clone test
   for it.
Changes in v4:
 * Patch 2: dropped the part that hides credentials as Stolee was not
   convinced it is needed. The part that names the URL that was passed
   in stays, as Patrick wanted. The patch has a new title and its test
   no longer uses a password.
 * Patch 3: fixed the commit message. Previously it said that the
   clone carries on with the other bundles. That is true only for the
   bundles before the bad entry, in a list that a server advertises. A
   list given to --bundle-uri is rejected as a whole. In both cases,
   the clone fetches the rest from the remote. No code change.
Aniket Gupta (3):
  remote: add relative_url_gently()
  remote: name the original URL when relative_url() fails
  bundle-uri: do not die on unresolvable relative URIs
 bundle-uri.c                | 29 ++++++++++++++++++++++++++---
 remote.c                    | 34 ++++++++++++++++++++++++++++------
 remote.h                    |  8 ++++++++
 t/t0060-path-utils.sh       |  9 +++++++++
 t/t5558-clone-bundle-uri.sh | 16 ++++++++++++++++
 t/t5750-bundle-uri-parse.sh | 24 ++++++++++++++++--------
 6 files changed, 103 insertions(+), 17 deletions(-)
Range-diff against v5:
1:  0f15f6c89c = 1:  0f15f6c89c remote: add relative_url_gently()
2:  bcec8bf453 = 2:  bcec8bf453 remote: name the original URL when relative_url() fails
3:  ed34ce04d2 ! 3:  16e6441992 bundle-uri: do not die on unresolvable relative URIs
    @@ Commit message
         Resolve them with relative_url_gently() instead. When that fails,
         bundle_list_update() reports the problem as an error, drops the bundle,
         which has no URI to use, and stops parsing the list. Dropping it keeps
    -    the clone from complaining a second time that the bundle has no URI.
    +    the clone from complaining a second time that the bundle has no URI. A
    +    "uri" key without a value is handled in the same way.
     
         What happens then depends on where the list came from. For a list
         advertised by a server, the bundles before the bad entry are still
    @@ Commit message
         Signed-off-by: Aniket Gupta <aniketgupta3001@gmail.com>
     
      ## bundle-uri.c ##
    +@@ bundle-uri.c: void print_bundle_list(FILE *fp, struct bundle_list *list)
    + 	for_all_bundles_in_list(list, summarize_bundle, fp);
    + }
    + 
    ++/*
    ++ * Remove a bundle from the list when its URI cannot be used, so that the
    ++ * list does not keep an entry without a URI.
    ++ */
    ++static int drop_bundle(struct bundle_list *list,
    ++		       struct remote_bundle_info *bundle)
    ++{
    ++	hashmap_remove(&list->bundles, &bundle->ent, NULL);
    ++	clear_remote_bundle_info(bundle, NULL);
    ++	free(bundle);
    ++	return -1;
    ++}
    ++
    + /**
    +  * Given a key-value pair, update the state of the given bundle list.
    +  * Returns 0 if the key-value pair is understood. Returns -1 if the key
     @@ bundle-uri.c: static int bundle_list_update(const char *key, const char *value,
      	strbuf_release(&id);
      
      	if (!strcmp(subkey, "uri")) {
    +-		if (!value)
    +-			return config_error_nonbool(key);
     +		struct strbuf err = STRBUF_INIT;
     +
    - 		if (!value)
    - 			return config_error_nonbool(key);
    ++		if (!value) {
    ++			config_error_nonbool(key);
    ++			return drop_bundle(list, bundle);
    ++		}
      		if (bundle->uri)
      			return -1;
     -		bundle->uri = relative_url(list->baseURI, value, NULL);
    @@ bundle-uri.c: static int bundle_list_update(const char *key, const char *value,
     +		if (!bundle->uri) {
     +			error("%s", err.buf);
     +			strbuf_release(&err);
    -+			hashmap_remove(&list->bundles, &bundle->ent, NULL);
    -+			clear_remote_bundle_info(bundle, NULL);
    -+			free(bundle);
    -+			return -1;
    ++			return drop_bundle(list, bundle);
     +		}
      		return 0;
      	}
    @@ t/t5750-bundle-uri-parse.sh: test_expect_success 'bundle_uri_parse_line(): relat
      '
      
      test_expect_success 'bundle_uri_parse_line() parsing edge cases: empty key or value' '
    +@@ t/t5750-bundle-uri-parse.sh: test_expect_success 'parse config format edge cases: keys without a value' '
    + 	done
    + '
    + 
    ++test_expect_success 'parse config format edge cases: a uri without a value drops the bundle' '
    ++	printf "[bundle]\n\tversion = 1\n\tmode = all\n[bundle \"one\"]\n\turi\n" >input &&
    ++
    ++	test_must_fail test-tool bundle-uri parse-config input >actual 2>err &&
    ++	test_grep "missing value for .bundle.one.uri." err &&
    ++	test_grep "mode = all" actual &&
    ++	test_grep ! "bundle .one." actual
    ++'
    ++
    + test_done
base-commit: acba8bf9753134d9bde89f94369f775838a8c5fe
-- 
2.54.0 (Apple Git-157)
Previous: Aniket GuptaNext: Aniket Gupta
Message 33 of 37 in “bundle-uri: do not die on unresolvable relative URIs”
  1. 0/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 5, 2026
  2. 1/3 remote: add relative_url_gently()Aniket Gupta, Nov 5, 2026
  3. Derrick StoleeNov 6, 2026
  4. 2/3 remote: do not show credentials when relative_url() failsAniket Gupta, Nov 5, 2026
  5. Derrick StoleeNov 6, 2026
  6. Junio C HamanoNov 6, 2026
  7. Aniket GuptaNov 9, 2026
  8. 3/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 5, 2026
  9. Derrick StoleeNov 6, 2026
  10. Derrick StoleeNov 6, 2026
  11. Aniket GuptaNov 6, 2026
  12. Patrick SteinhardtNov 9, 2026
  13. Aniket GuptaNov 9, 2026
  14. 0/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 23, 2026
  15. 1/3 remote: add relative_url_gently()Aniket Gupta, Nov 23, 2026
  16. 2/3 remote: name the original URL when relative_url() failsAniket Gupta, Nov 23, 2026
  17. 3/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 23, 2026
  18. Junio C HamanoNov 23, 2026
  19. Aniket GuptaNov 23, 2026
  20. Derrick StoleeNov 23, 2026
  21. 0/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 26, 2026
  22. 1/3 remote: add relative_url_gently()Aniket Gupta, Nov 26, 2026
  23. 2/3 remote: name the original URL when relative_url() failsAniket Gupta, Nov 26, 2026
  24. Patrick SteinhardtDec 1, 2026
  25. Aniket GuptaDec 1, 2026
  26. 3/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 26, 2026
  27. Derrick StoleeNov 30, 2026
  28. Patrick SteinhardtDec 1, 2026
  29. Aniket GuptaDec 1, 2026
  30. Patrick SteinhardtDec 2, 2026
  31. Patrick SteinhardtDec 1, 2026
  32. Aniket GuptaDec 1, 2026
  33. 0/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Dec 2, 2026
  34. 1/3 remote: add relative_url_gently()Aniket Gupta, Dec 2, 2026
  35. 2/3 remote: name the original URL when relative_url() failsAniket Gupta, Dec 2, 2026
  36. 3/3 bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Dec 2, 2026
  37. Patrick SteinhardtDec 3, 2026

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.