aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/hash-object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-30 14:15:13 -0700
committerJunio C Hamano <gitster@pobox.com>2024-05-30 14:15:14 -0700
commit6c5be97e4eee040a2d5303e5650fa7cc8a37dbd8 (patch)
treee473e1ea7754091c4e4b13e1af93c9cc3638dcba /builtin/hash-object.c
parent988499e2955f052fa5f58434e13d12285cb8a361 (diff)
parent4674ab682dc1a875fd29de8f4e9568196a88b97b (diff)
downloadgit-6c5be97e4eee040a2d5303e5650fa7cc8a37dbd8.tar.gz
Merge branch 'jc/undecided-is-not-necessarily-sha1-fix'
The base topic started to make it an error for a command to leave the hash algorithm unspecified, which revealed a few commands that were not ready for the change. Give users a knob to revert back to the "default is sha-1" behaviour as an escape hatch, and start fixing these breakages. * jc/undecided-is-not-necessarily-sha1-fix: apply: fix uninitialized hash function builtin/hash-object: fix uninitialized hash function builtin/patch-id: fix uninitialized hash function t1517: test commands that are designed to be run outside repository setup: add an escape hatch for "no more default hash algorithm" change
Diffstat (limited to 'builtin/hash-object.c')
-rw-r--r--builtin/hash-object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 82ca6d2bfd..c767414a0c 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -123,6 +123,9 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)
else
prefix = setup_git_directory_gently(&nongit);
+ if (nongit && !the_hash_algo)
+ repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
+
if (vpath && prefix) {
vpath_free = prefix_filename(prefix, vpath);
vpath = vpath_free;