mirror of
https://github.com/git/git.git
synced 2024-12-02 06:24:01 +08:00
fa74052922
Copying the arguments from a fetch_pack_args into static globals within the builtin-fetch-pack module is error-prone and may lead rise to cases where arguments supplied via the struct from the new fetch_pack() API may not be honored by the implementation. Here we reorganize all of the static globals into a single static struct fetch_pack_args instance and use memcpy() to move the data from the caller supplied structure into the globals before we execute our pack fetching implementation. This strategy is more robust to additions and deletions of properties. As keep_pack is a single bit we have also introduced lock_pack to mean not only download and store the packfile via index-pack but also to lock it against repacking by creating a .keep file when the packfile itself is stored. The caller must remove the .keep file when it is safe to do so. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
25 lines
378 B
C
25 lines
378 B
C
#ifndef FETCH_PACK_H
|
|
#define FETCH_PACK_H
|
|
|
|
struct fetch_pack_args
|
|
{
|
|
const char *uploadpack;
|
|
int unpacklimit;
|
|
int depth;
|
|
unsigned quiet:1,
|
|
keep_pack:1,
|
|
lock_pack:1,
|
|
use_thin_pack:1,
|
|
fetch_all:1,
|
|
verbose:1,
|
|
no_progress:1;
|
|
};
|
|
|
|
struct ref *fetch_pack(struct fetch_pack_args *args,
|
|
const char *dest,
|
|
int nr_heads,
|
|
char **heads,
|
|
char **pack_lockfile);
|
|
|
|
#endif
|