From dc9c16c2fc8222364277696cb4d70782281d3c06 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 1 Jul 2025 21:22:29 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/diff.c') diff --git a/builtin/diff.c b/builtin/diff.c index fa963808c3..357702df9e 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -483,7 +483,7 @@ int cmd_diff(int argc, * configurable via a command line option. */ if (nongit) - repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); init_diff_ui_defaults(); git_config(git_diff_ui_config, NULL); -- cgit v1.2.3