Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
verify-pack: fall back to SHA-1 outside a repo
In c8aed5e (repository: stop setting SHA1 as the default object hash, 2024-05-07), we have stopped setting the default hash algorithm for `the_repository`. Consequently, code that relies on `the_hash_algo` will now crash when it hasn't explicitly been initialized, which may be the case when running outside of a Git repository. As the verify-pack command ought to be able to infer what algorithm is used in the input file (and if the input file does not have such an information, that by itself is a problem), and the command allows an option to explicitly tell what algorithm to use in case it cannot be guessed from the input file, in theory we shouldn't have to use the default algorithm anywhere in the operation of the command, but we fail fairly early in the process when run outside a repository without any default algorithm set. Resurrect the setting of the default algorithm just like we used to do before 2.46.0 Reported-by: Ilya K <me@0upti.me> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information