Skip to content

Commit 84df6e3

Browse files
rscharfegitster
authored andcommitted
split-index: stop using the_repository and the_hash_algo
Reference the hash algorithm of the passed-in index throughout the code. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7ff1e8d commit 84df6e3

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

split-index.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#define USE_THE_REPOSITORY_VARIABLE
21
#define DISABLE_SIGN_COMPARE_WARNINGS
32

43
#include "git-compat-util.h"
54
#include "gettext.h"
65
#include "hash.h"
76
#include "mem-pool.h"
87
#include "read-cache-ll.h"
8+
#include "repository.h"
99
#include "split-index.h"
1010
#include "strbuf.h"
1111
#include "ewah/ewok.h"
@@ -25,16 +25,17 @@ struct split_index *init_split_index(struct index_state *istate)
2525
int read_link_extension(struct index_state *istate,
2626
const void *data_, unsigned long sz)
2727
{
28+
const struct git_hash_algo *algo = istate->repo->hash_algo;
2829
const unsigned char *data = data_;
2930
struct split_index *si;
3031
int ret;
3132

32-
if (sz < the_hash_algo->rawsz)
33+
if (sz < algo->rawsz)
3334
return error("corrupt link extension (too short)");
3435
si = init_split_index(istate);
35-
oidread(&si->base_oid, data, the_repository->hash_algo);
36-
data += the_hash_algo->rawsz;
37-
sz -= the_hash_algo->rawsz;
36+
oidread(&si->base_oid, data, algo);
37+
data += algo->rawsz;
38+
sz -= algo->rawsz;
3839
if (!sz)
3940
return 0;
4041
si->delete_bitmap = ewah_new();
@@ -56,7 +57,7 @@ int write_link_extension(struct strbuf *sb,
5657
struct index_state *istate)
5758
{
5859
struct split_index *si = istate->split_index;
59-
strbuf_add(sb, si->base_oid.hash, the_hash_algo->rawsz);
60+
strbuf_add(sb, si->base_oid.hash, istate->repo->hash_algo->rawsz);
6061
if (!si->delete_bitmap && !si->replace_bitmap)
6162
return 0;
6263
ewah_serialize_strbuf(si->delete_bitmap, sb);

0 commit comments

Comments
 (0)