aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/index-pack.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2025-07-01 21:22:29 +0000
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:58:24 -0700
commitdc9c16c2fc8222364277696cb4d70782281d3c06 (patch)
treea0f7dc4e04712c34e961b7b6a354c57be86d7a74 /builtin/index-pack.c
parenthash: add a constant for the legacy hash algorithm (diff)
downloadgit-dc9c16c2fc8222364277696cb4d70782281d3c06.tar.gz
git-dc9c16c2fc8222364277696cb4d70782281d3c06.zip
builtin: use default hash when outside a repository
We have some commands that can operate inside or outside a repository. If we're operating outside a repository, we clearly cannot use the repository's hash algorithm as a default since it doesn't exist, so instead, let's pick the default instead of specifically SHA-1. Right now this results in no functional change since the default is SHA-1, but that may change in the future. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index bb7925bd29..352ce7f88a 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -2034,7 +2034,7 @@ int cmd_index_pack(int argc,
* choice but to guess the object hash.
*/
if (!the_repository->hash_algo)
- repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
+ repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
opts.flags &= ~(WRITE_REV | WRITE_REV_VERIFY);
if (rev_index) {