зеркало из https://github.com/microsoft/git.git
Merge branch 'nd/gc-aggressive'
Allow tweaking the maximum length of the delta-chain produced by "gc --aggressive". * nd/gc-aggressive: environment.c: fix constness for odb_pack_keep() gc --aggressive: make --depth configurable
This commit is contained in:
Коммит
8815d8aa7c
|
@ -1156,6 +1156,11 @@ filter.<driver>.smudge::
|
||||||
object to a worktree file upon checkout. See
|
object to a worktree file upon checkout. See
|
||||||
linkgit:gitattributes[5] for details.
|
linkgit:gitattributes[5] for details.
|
||||||
|
|
||||||
|
gc.aggressiveDepth::
|
||||||
|
The depth parameter used in the delta compression
|
||||||
|
algorithm used by 'git gc --aggressive'. This defaults
|
||||||
|
to 250.
|
||||||
|
|
||||||
gc.aggressiveWindow::
|
gc.aggressiveWindow::
|
||||||
The window size parameter used in the delta compression
|
The window size parameter used in the delta compression
|
||||||
algorithm used by 'git gc --aggressive'. This defaults
|
algorithm used by 'git gc --aggressive'. This defaults
|
||||||
|
|
|
@ -124,6 +124,9 @@ the value, the more time is spent optimizing the delta compression. See
|
||||||
the documentation for the --window' option in linkgit:git-repack[1] for
|
the documentation for the --window' option in linkgit:git-repack[1] for
|
||||||
more details. This defaults to 250.
|
more details. This defaults to 250.
|
||||||
|
|
||||||
|
Similarly, the optional configuration variable 'gc.aggressiveDepth'
|
||||||
|
controls --depth option in linkgit:git-repack[1]. This defaults to 250.
|
||||||
|
|
||||||
The optional configuration variable 'gc.pruneExpire' controls how old
|
The optional configuration variable 'gc.pruneExpire' controls how old
|
||||||
the unreferenced loose objects have to be before they are pruned. The
|
the unreferenced loose objects have to be before they are pruned. The
|
||||||
default is "2 weeks ago".
|
default is "2 weeks ago".
|
||||||
|
|
|
@ -26,6 +26,7 @@ static const char * const builtin_gc_usage[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pack_refs = 1;
|
static int pack_refs = 1;
|
||||||
|
static int aggressive_depth = 250;
|
||||||
static int aggressive_window = 250;
|
static int aggressive_window = 250;
|
||||||
static int gc_auto_threshold = 6700;
|
static int gc_auto_threshold = 6700;
|
||||||
static int gc_auto_pack_limit = 50;
|
static int gc_auto_pack_limit = 50;
|
||||||
|
@ -66,6 +67,10 @@ static int gc_config(const char *var, const char *value, void *cb)
|
||||||
aggressive_window = git_config_int(var, value);
|
aggressive_window = git_config_int(var, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(var, "gc.aggressivedepth")) {
|
||||||
|
aggressive_depth = git_config_int(var, value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (!strcmp(var, "gc.auto")) {
|
if (!strcmp(var, "gc.auto")) {
|
||||||
gc_auto_threshold = git_config_int(var, value);
|
gc_auto_threshold = git_config_int(var, value);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -294,7 +299,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
if (aggressive) {
|
if (aggressive) {
|
||||||
argv_array_push(&repack, "-f");
|
argv_array_push(&repack, "-f");
|
||||||
argv_array_push(&repack, "--depth=250");
|
if (aggressive_depth > 0)
|
||||||
|
argv_array_pushf(&repack, "--depth=%d", aggressive_depth);
|
||||||
if (aggressive_window > 0)
|
if (aggressive_window > 0)
|
||||||
argv_array_pushf(&repack, "--window=%d", aggressive_window);
|
argv_array_pushf(&repack, "--window=%d", aggressive_window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern)
|
||||||
return xmkstemp_mode(template, mode);
|
return xmkstemp_mode(template, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int odb_pack_keep(char *name, size_t namesz, unsigned char *sha1)
|
int odb_pack_keep(char *name, size_t namesz, const unsigned char *sha1)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@ extern FILE *xfdopen(int fd, const char *mode);
|
||||||
extern int xmkstemp(char *template);
|
extern int xmkstemp(char *template);
|
||||||
extern int xmkstemp_mode(char *template, int mode);
|
extern int xmkstemp_mode(char *template, int mode);
|
||||||
extern int odb_mkstemp(char *template, size_t limit, const char *pattern);
|
extern int odb_mkstemp(char *template, size_t limit, const char *pattern);
|
||||||
extern int odb_pack_keep(char *name, size_t namesz, unsigned char *sha1);
|
extern int odb_pack_keep(char *name, size_t namesz, const unsigned char *sha1);
|
||||||
|
|
||||||
static inline size_t xsize_t(off_t len)
|
static inline size_t xsize_t(off_t len)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче