aboutsummaryrefslogtreecommitdiffstats
path: root/repository.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-13 12:24:54 -0700
committerJunio C Hamano <gitster@pobox.com>2024-05-13 12:24:54 -0700
commit17bc3a4767f2de77b9eb4a8a7b7da966ffbe7ec0 (patch)
tree3e91636cac7d4405f77b8722efce98d488671e9c /repository.c
parent3e4a232f6e3bd3b7dd920bb07b21cf1c8b4e1a7f (diff)
parentc8aed5e8dadf913e041cde72d704aa91f378b71b (diff)
downloadgit-17bc3a4767f2de77b9eb4a8a7b7da966ffbe7ec0.tar.gz
Merge branch 'ps/undecided-is-not-necessarily-sha1' into jc/undecided-is-not-necessarily-sha1-fix
* ps/undecided-is-not-necessarily-sha1: repository: stop setting SHA1 as the default object hash oss-fuzz/commit-graph: set up hash algorithm builtin/shortlog: don't set up revisions without repo builtin/diff: explicitly set hash algo when there is no repo builtin/bundle: abort "verify" early when there is no repository builtin/blame: don't access potentially unitialized `the_hash_algo` builtin/rev-parse: allow shortening to more than 40 hex characters remote-curl: fix parsing of detached SHA256 heads attr: fix BUG() when parsing attrs outside of repo attr: don't recompute default attribute source parse-options-cb: only abbreviate hashes when hash algo is known path: move `validate_headref()` to its only user path: harden validation of HEAD with non-standard hashes
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/repository.c b/repository.c
index 2118f563e3..15c10015b0 100644
--- a/repository.c
+++ b/repository.c
@@ -26,26 +26,6 @@ void initialize_repository(struct repository *repo)
repo->parsed_objects = parsed_object_pool_new();
ALLOC_ARRAY(repo->index, 1);
index_state_init(repo->index, repo);
-
- /*
- * Unfortunately, we need to keep this hack around for the time being:
- *
- * - Not setting up the hash algorithm for `the_repository` leads to
- * crashes because `the_hash_algo` is a macro that expands to
- * `the_repository->hash_algo`. So if Git commands try to access
- * `the_hash_algo` without a Git directory we crash.
- *
- * - Setting up the hash algorithm to be SHA1 by default breaks other
- * commands when running with SHA256.
- *
- * This is another point in case why having global state is a bad idea.
- * Eventually, we should remove this hack and stop setting the hash
- * algorithm in this function altogether. Instead, it should only ever
- * be set via our repository setup procedures. But that requires more
- * work.
- */
- if (repo == the_repository)
- repo_set_hash_algo(repo, GIT_HASH_SHA1);
}
static void expand_base_dir(char **out, const char *in,