mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
packfile: add repository to struct packed_git
The struct `packed_git` holds information regarding a packed object file. Let's add the repository variable to this object, to represent the repository that this packfile belongs to. This helps remove dependency on the global `the_repository` object in `packfile.c` by simply using repository information now readily available in the struct. We do need to consider that a packfile could be part of the alternates of a repository, but considering that we only have one repository struct and also that we currently anyways use 'the_repository', we should be OK with this change. We also modify `alloc_packed_git` to ensure that the repository is added to newly created `packed_git` structs. This requires modifying the function and all its callee to pass the repository object down the levels. Helped-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8f8d6eee53
commit
2cf3fe63f6
@@ -46,7 +46,8 @@ const char *pack_basename(struct packed_git *p);
|
||||
* and does not add the resulting packed_git struct to the internal list of
|
||||
* packs. You probably want add_packed_git() instead.
|
||||
*/
|
||||
struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
|
||||
struct packed_git *parse_pack_index(struct repository *r, unsigned char *sha1,
|
||||
const char *idx_path);
|
||||
|
||||
typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,
|
||||
const char *file_name, void *data);
|
||||
@@ -113,7 +114,8 @@ void close_pack(struct packed_git *);
|
||||
void close_object_store(struct raw_object_store *o);
|
||||
void unuse_pack(struct pack_window **);
|
||||
void clear_delta_base_cache(void);
|
||||
struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
|
||||
struct packed_git *add_packed_git(struct repository *r, const char *path,
|
||||
size_t path_len, int local);
|
||||
|
||||
/*
|
||||
* Unlink the .pack and associated extension files.
|
||||
|
||||
Reference in New Issue
Block a user