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>maint
parent
7ff1e8dc1e
commit
84df6e3501
|
|
@ -1,4 +1,3 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
|
|
@ -6,6 +5,7 @@
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "mem-pool.h"
|
#include "mem-pool.h"
|
||||||
#include "read-cache-ll.h"
|
#include "read-cache-ll.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "split-index.h"
|
#include "split-index.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "ewah/ewok.h"
|
#include "ewah/ewok.h"
|
||||||
|
|
@ -25,16 +25,17 @@ struct split_index *init_split_index(struct index_state *istate)
|
||||||
int read_link_extension(struct index_state *istate,
|
int read_link_extension(struct index_state *istate,
|
||||||
const void *data_, unsigned long sz)
|
const void *data_, unsigned long sz)
|
||||||
{
|
{
|
||||||
|
const struct git_hash_algo *algo = istate->repo->hash_algo;
|
||||||
const unsigned char *data = data_;
|
const unsigned char *data = data_;
|
||||||
struct split_index *si;
|
struct split_index *si;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sz < the_hash_algo->rawsz)
|
if (sz < algo->rawsz)
|
||||||
return error("corrupt link extension (too short)");
|
return error("corrupt link extension (too short)");
|
||||||
si = init_split_index(istate);
|
si = init_split_index(istate);
|
||||||
oidread(&si->base_oid, data, the_repository->hash_algo);
|
oidread(&si->base_oid, data, algo);
|
||||||
data += the_hash_algo->rawsz;
|
data += algo->rawsz;
|
||||||
sz -= the_hash_algo->rawsz;
|
sz -= algo->rawsz;
|
||||||
if (!sz)
|
if (!sz)
|
||||||
return 0;
|
return 0;
|
||||||
si->delete_bitmap = ewah_new();
|
si->delete_bitmap = ewah_new();
|
||||||
|
|
@ -56,7 +57,7 @@ int write_link_extension(struct strbuf *sb,
|
||||||
struct index_state *istate)
|
struct index_state *istate)
|
||||||
{
|
{
|
||||||
struct split_index *si = istate->split_index;
|
struct split_index *si = istate->split_index;
|
||||||
strbuf_add(sb, si->base_oid.hash, the_hash_algo->rawsz);
|
strbuf_add(sb, si->base_oid.hash, istate->repo->hash_algo->rawsz);
|
||||||
if (!si->delete_bitmap && !si->replace_bitmap)
|
if (!si->delete_bitmap && !si->replace_bitmap)
|
||||||
return 0;
|
return 0;
|
||||||
ewah_serialize_strbuf(si->delete_bitmap, sb);
|
ewah_serialize_strbuf(si->delete_bitmap, sb);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue