summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-02-22 20:17:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-24 17:33:21 (GMT)
commit94127599252d85e85571ecde740ea97e59e4bede (patch)
tree406c9dca8c4fa051dc31b43228c87bbf0a2e34dd /repository.c
parent61e2a70ff26f83f761fa36e0cc16996878d8dd59 (diff)
downloadgit-94127599252d85e85571ecde740ea97e59e4bede.zip
git-94127599252d85e85571ecde740ea97e59e4bede.tar.gz
git-94127599252d85e85571ecde740ea97e59e4bede.tar.bz2
repository: require a build flag to use SHA-256
At this point, SHA-256 support is experimental and some behavior may change. To avoid surprising unsuspecting users, require a build flag, ENABLE_SHA256, to allow use of a non-SHA-1 algorithm. Enable this flag by default when the DEVELOPER make flag is set so that contributors can test this case adequately. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/repository.c b/repository.c
index a4174dd..6f7f6f0 100644
--- a/repository.c
+++ b/repository.c
@@ -89,6 +89,10 @@ void repo_set_gitdir(struct repository *repo,
void repo_set_hash_algo(struct repository *repo, int hash_algo)
{
repo->hash_algo = &hash_algos[hash_algo];
+#ifndef ENABLE_SHA256
+ if (hash_algo != GIT_HASH_SHA1)
+ die(_("The hash algorithm %s is not supported in this build."), repo->hash_algo->name);
+#endif
}
/*