diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2024-10-09 02:58:59 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-10-09 11:51:31 -0700 |
| commit | 432f666aa6d9f69d578d44f8c6d6bdb865152ad5 (patch) | |
| tree | e5705e13c4541af55faafabfbe4a037f70c29ac0 | |
| parent | 777489f9e09c8d0dd6b12f9d90de6376330577a2 (diff) | |
| download | git-432f666aa6d9f69d578d44f8c6d6bdb865152ad5.tar.gz | |
loose: don't rely on repository global state
In `loose.c`, we rely on the global variable `the_hash_algo`. As such we
have guarded the file with the 'USE_THE_REPOSITORY_VARIABLE' definition.
Let's derive the hash algorithm from the available repository variable
and remove this guard. This brings us one step closer to removing the
global 'the_repository' variable.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | loose.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,10 +1,9 @@ -#define USE_THE_REPOSITORY_VARIABLE - #include "git-compat-util.h" #include "hash.h" #include "path.h" #include "object-store.h" #include "hex.h" +#include "repository.h" #include "wrapper.h" #include "gettext.h" #include "loose.h" @@ -142,8 +141,8 @@ int repo_write_loose_object_map(struct repository *repo) for (; iter != kh_end(map); iter++) { if (kh_exist(map, iter)) { - if (oideq(&kh_key(map, iter), the_hash_algo->empty_tree) || - oideq(&kh_key(map, iter), the_hash_algo->empty_blob)) + if (oideq(&kh_key(map, iter), repo->hash_algo->empty_tree) || + oideq(&kh_key(map, iter), repo->hash_algo->empty_blob)) continue; strbuf_addf(&buf, "%s %s\n", oid_to_hex(&kh_key(map, iter)), oid_to_hex(kh_value(map, iter))); if (write_in_full(fd, buf.buf, buf.len) < 0) |
