Skip to content

Commit 5babff1

Browse files
stefanbellergitster
authored andcommitted
packfile: allow install_packed_git to handle arbitrary repositories
This conversion was done without the #define trick used in the earlier series refactoring to have better repository access, because this function is easy to review, as it only has one caller and all lines but the first two are converted. We must not convert 'pack_open_fds' to be a repository specific variable, as it is used to monitor resource usage of the machine that Git executes on. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c235bea commit 5babff1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static void end_packfile(void)
10381038
if (!new_p)
10391039
die("core git rejected index %s", idx_name);
10401040
all_packs[pack_id] = new_p;
1041-
install_packed_git(new_p);
1041+
install_packed_git(the_repository, new_p);
10421042
free(idx_name);
10431043

10441044
/* Print the boundary */

http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ int finish_http_pack_request(struct http_pack_request *preq)
21342134
return -1;
21352135
}
21362136

2137-
install_packed_git(p);
2137+
install_packed_git(the_repository, p);
21382138
free(tmp_idx);
21392139
return 0;
21402140
}

packfile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,13 +680,13 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
680680
return p;
681681
}
682682

683-
void install_packed_git(struct packed_git *pack)
683+
void install_packed_git(struct repository *r, struct packed_git *pack)
684684
{
685685
if (pack->pack_fd != -1)
686686
pack_open_fds++;
687687

688-
pack->next = the_repository->objects->packed_git;
689-
the_repository->objects->packed_git = pack;
688+
pack->next = r->objects->packed_git;
689+
r->objects->packed_git = pack;
690690
}
691691

692692
void (*report_garbage)(unsigned seen_bits, const char *path);
@@ -782,7 +782,7 @@ static void prepare_packed_git_one(char *objdir, int local)
782782
* corresponding .pack file that we can map.
783783
*/
784784
(p = add_packed_git(path.buf, path.len, local)) != NULL)
785-
install_packed_git(p);
785+
install_packed_git(the_repository, p);
786786
}
787787

788788
if (!report_garbage)

packfile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
3636

3737
extern void prepare_packed_git(void);
3838
extern void reprepare_packed_git(void);
39-
extern void install_packed_git(struct packed_git *pack);
39+
extern void install_packed_git(struct repository *r, struct packed_git *pack);
4040

4141
struct packed_git *get_packed_git(struct repository *r);
4242
struct list_head *get_packed_git_mru(struct repository *r);

0 commit comments

Comments
 (0)