This might be more robust now: "git clone
"(man) from SHA256 repository by Git built with SHA-1 as the default hash algorithm over the dumb HTTP protocol did not correctly set up the resulting repository, which has been corrected with Git 2.32 (Q2 2021, 8 years later).
See commit 00bc839 (11 May 2021) by Eric Wong (ele828
).
(Merged by Junio C Hamano -- gitster
-- in commit bdff041, 20 May 2021)
remote-curl
: fix clone on sha256 repos
Signed-off-by: Eric Wong
Acked-by: brian m. carlson
The remote-https process needs to update it's own instance of the_repository, when it sees an HTTP(S) remote is using sha256.
Without this, parse_oid_hex()
fails to handle sha256 OIDs when it's eventually called by parse_fetch()
.
Tested with:
git clone https://yhbt.net/sha256test.git
GIT_SMART_HTTP=0 git clone https://yhbt.net/sha256test.git
(plain http:// also works)
Cloning the URL via git:// required no changes
Note: With Git 2.41 (Q2 2023), the documentation was misleading about the interaction between GIT_DEFAULT_HASH
and "git clone
"(man), which has been clarified to stress that the variable is to be ignored by the command.
See commit 5f0e37b (26 Apr 2023) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit b14a730, 15 May 2023)
doc
: GIT_DEFAULT_HASH
is and will be ignored during "clone
"
The phrasing "is currently ignored" was prone to be misinterpreted as if we were wishing if it were honored.
Rephrase it to make it clear that the experimental variable will be ignored.
In the longer term, after/when we allow incremental/over-the-wire migration of the object-format, i.e.
cloning from an SHA-1 repository to create an SHA-256 repository (or vice versa) and fetching and pushing between them would bidirectionally convert the object format on the fly, it is likely that we would teach a new option "--object-format" to "git clone
"(man) to say you would use whatever object format the origin uses by default, but this time, I am telling you to use this format on our side, doing on-the-fly object format conversion as needed".
So it is perfectly OK to ignore the settings of this experimental variable, even after such an extension happens that makes it necessary for us to have a way to create a new repository that uses different object format from the origin repository.
git
now includes in its man page:
GIT_DEFAULT_HASH
This value is
ignored when cloning and the setting of the remote repository
is always used. The default is "sha1
".