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

Re: [PATCH v3 1/2] refspec: safely parse refspecs outside a repository

From
Jeff King <peff@peff.net>
Date
Mar 23, 2026, 23:10 UTC
Message-ID
<20260323231049.GA23721@coredump.intra.peff.net>
In-Reply-To
<xmqq341q41wu.fsf@gitster.g>
On Mon, Mar 23, 2026 at 03:27:29PM -0700, Junio C Hamano wrote:
> Looking good.  Shall we declare victory and mark the topic for
> 'next' by now?
I'm not entirely convinced the better solution isn't just:
diff --git a/remote-curl.c b/remote-curl.c
index 92e40bb682..60774af929 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1552,6 +1552,11 @@ int cmd_main(int argc, const char **argv)
 		goto cleanup;
 	}
 
+	/* yuck, see 9e89dcb66a (builtin/ls-remote: fall back to SHA1 outside
+	 * of a repo, 2024-08-02) */
+	if (nongit)
+		repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
+
 	options.verbosity = 1;
 	options.progress = !!isatty(2);
 	options.thin = 1;

That would make the http transport consistent with non-http ones (or at
least any that execute in-process within ls-remote).

Or alternatively, if we think that this use of parse_refspec() is the
only remaining spot for which ls-remote needs a fallback, then we could
apply the patch here and then revert 9e89dcb66a.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 17 in “remote-curl: segfault parsing remote.<name>.fetch outside a repository”
  1. Jo LissMar 21, 2026
  2. remote-curl: set fallback hash algorithm outside repoK Jayatheerth, Mar 21, 2026
  3. brian m. carlsonMar 21, 2026
  4. refspec: safely parse refspecs outside a repositoryK Jayatheerth, Mar 22, 2026
  5. Junio C HamanoMar 22, 2026
  6. Jeff KingMar 22, 2026
  7. 1/2 refspec: safely parse refspecs outside a repositoryK Jayatheerth, Mar 22, 2026
  8. 2/2 refspec: fix typo in commentK Jayatheerth, Mar 22, 2026
  9. Junio C HamanoMar 23, 2026
  10. Jeff KingMar 23, 2026
  11. Junio C HamanoMar 23, 2026
  12. 1/2 remote-curl: fall back to default hash outside repoK Jayatheerth, Mar 24, 2026
  13. 2/2 refspec: fix typo in commentK Jayatheerth, Mar 24, 2026
  14. Junio C HamanoMar 24, 2026
  15. Jeff KingMar 21, 2026
  16. Junio C HamanoMar 22, 2026
  17. Jeff KingMar 22, 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.