packfile: add repository argument to reprepare_packed_git

See previous patch for explanation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Stefan Beller 2018-03-23 18:45:21 +01:00 committed by Junio C Hamano
parent 6fdb4e9f5a
commit a49d283435
7 changed files with 11 additions and 7 deletions

View File

@ -478,7 +478,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
return error(FAILED_RUN, rerere.argv[0]); return error(FAILED_RUN, rerere.argv[0]);


report_garbage = report_pack_garbage; report_garbage = report_pack_garbage;
reprepare_packed_git(); reprepare_packed_git(the_repository);
if (pack_garbage.nr > 0) if (pack_garbage.nr > 0)
clean_pack_garbage(); clean_pack_garbage();



View File

@ -1,4 +1,5 @@
#include "builtin.h" #include "builtin.h"
#include "repository.h"
#include "config.h" #include "config.h"
#include "lockfile.h" #include "lockfile.h"
#include "pack.h" #include "pack.h"
@ -1777,7 +1778,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
status = finish_command(&child); status = finish_command(&child);
if (status) if (status)
return "index-pack abnormal exit"; return "index-pack abnormal exit";
reprepare_packed_git(); reprepare_packed_git(the_repository);
} }
return NULL; return NULL;
} }

View File

@ -3,6 +3,7 @@
*/ */
#include "cache.h" #include "cache.h"
#include "bulk-checkin.h" #include "bulk-checkin.h"
#include "repository.h"
#include "csum-file.h" #include "csum-file.h"
#include "pack.h" #include "pack.h"
#include "strbuf.h" #include "strbuf.h"
@ -57,7 +58,7 @@ clear_exit:


strbuf_release(&packname); strbuf_release(&packname);
/* Make objects we just wrote available to ourselves */ /* Make objects we just wrote available to ourselves */
reprepare_packed_git(); reprepare_packed_git(the_repository);
} }


static int already_written(struct bulk_checkin_state *state, unsigned char sha1[]) static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])

View File

@ -1,4 +1,5 @@
#include "cache.h" #include "cache.h"
#include "repository.h"
#include "config.h" #include "config.h"
#include "lockfile.h" #include "lockfile.h"
#include "refs.h" #include "refs.h"
@ -1192,7 +1193,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
prepare_shallow_info(&si, shallow); prepare_shallow_info(&si, shallow);
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought, ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
&si, pack_lockfile); &si, pack_lockfile);
reprepare_packed_git(); reprepare_packed_git(the_repository);
update_shallow(args, sought, nr_sought, &si); update_shallow(args, sought, nr_sought, &si);
clear_shallow_info(&si); clear_shallow_info(&si);
return ref_cpy; return ref_cpy;

View File

@ -899,7 +899,7 @@ void prepare_packed_git_the_repository(void)
the_repository->objects->packed_git_initialized = 1; the_repository->objects->packed_git_initialized = 1;
} }


void reprepare_packed_git(void) void reprepare_packed_git_the_repository(void)
{ {
the_repository->objects->approximate_object_count_valid = 0; the_repository->objects->approximate_object_count_valid = 0;
the_repository->objects->packed_git_initialized = 0; the_repository->objects->packed_git_initialized = 0;

View File

@ -36,7 +36,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);


#define prepare_packed_git(r) prepare_packed_git_##r() #define prepare_packed_git(r) prepare_packed_git_##r()
extern void prepare_packed_git_the_repository(void); extern void prepare_packed_git_the_repository(void);
extern void reprepare_packed_git(void); #define reprepare_packed_git(r) reprepare_packed_git_##r()
extern void reprepare_packed_git_the_repository(void);
extern void install_packed_git(struct repository *r, struct packed_git *pack); extern void install_packed_git(struct repository *r, struct packed_git *pack);


struct packed_git *get_packed_git(struct repository *r); struct packed_git *get_packed_git(struct repository *r);

View File

@ -1274,7 +1274,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
return 0; return 0;


/* Not a loose object; someone else may have just packed it. */ /* Not a loose object; someone else may have just packed it. */
reprepare_packed_git(); reprepare_packed_git(the_repository);
if (find_pack_entry(real, &e)) if (find_pack_entry(real, &e))
break; break;