diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-14 14:54:49 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 14:54:49 -0700 |
| commit | 760348212b16379d2646751c2cd18a028cbdd02d (patch) | |
| tree | 0d9928c87157a79e284223c706dca7943dcc9a9f /builtin/ls-remote.c | |
| parent | ecbed3ff4597023f044f097c8da7f43a9228a5e1 (diff) | |
| parent | 9e89dcb66a70902fef966083998a75272d47d998 (diff) | |
| download | git-760348212b16379d2646751c2cd18a028cbdd02d.tar.gz | |
Merge branch 'ps/ls-remote-out-of-repo-fix'
A recent update broke "git ls-remote" used outside a repository,
which has been corrected.
* ps/ls-remote-out-of-repo-fix:
builtin/ls-remote: fall back to SHA1 outside of a repo
Diffstat (limited to 'builtin/ls-remote.c')
| -rw-r--r-- | builtin/ls-remote.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 5b61af5d78..0a491595ca 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -90,6 +90,21 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) PARSE_OPT_STOP_AT_NON_OPTION); dest = argv[0]; + /* + * TODO: This is buggy, but required for transport helpers. When a + * transport helper advertises a "refspec", then we'd add that to a + * list of refspecs via `refspec_append()`, which transitively depends + * on `the_hash_algo`. Thus, when the hash algorithm isn't properly set + * up, this would lead to a segfault. + * + * We really should fix this in the transport helper logic such that we + * lazily parse refspec capabilities _after_ we have learned about the + * remote's object format. Otherwise, we may end up misparsing refspecs + * depending on what object hash the remote uses. + */ + if (!the_repository->hash_algo) + repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + packet_trace_identity("ls-remote"); for (int i = 1; i < argc; i++) |
