зеркало из https://github.com/microsoft/git.git
git fast-export: add --no-data option
When using git fast-export and git fast-import to rewrite the history of a repository with large binary files, almost all of the time is spent dealing with blobs. This is extremely inefficient if all we want to do is rewrite the commits and tree structure. --no-data skips the output of blobs and writes SHA-1s instead of marks, which provides a massive speedup. Signed-off-by: Geoffrey Irving <irving@naml.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
86b5efb286
Коммит
79559f27be
|
@ -82,6 +82,14 @@ marks the same across runs.
|
||||||
allow that. So fake a tagger to be able to fast-import the
|
allow that. So fake a tagger to be able to fast-import the
|
||||||
output.
|
output.
|
||||||
|
|
||||||
|
--no-data::
|
||||||
|
Skip output of blob objects and instead refer to blobs via
|
||||||
|
their original SHA-1 hash. This is useful when rewriting the
|
||||||
|
directory structure or history of a repository without
|
||||||
|
touching the contents of individual files. Note that the
|
||||||
|
resulting stream can only be used by a repository which
|
||||||
|
already contains the necessary objects.
|
||||||
|
|
||||||
[git-rev-list-args...]::
|
[git-rev-list-args...]::
|
||||||
A list of arguments, acceptable to 'git-rev-parse' and
|
A list of arguments, acceptable to 'git-rev-parse' and
|
||||||
'git-rev-list', that specifies the specific objects and references
|
'git-rev-list', that specifies the specific objects and references
|
||||||
|
|
|
@ -26,6 +26,7 @@ static int progress;
|
||||||
static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
|
static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
|
||||||
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
|
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
|
||||||
static int fake_missing_tagger;
|
static int fake_missing_tagger;
|
||||||
|
static int no_data;
|
||||||
|
|
||||||
static int parse_opt_signed_tag_mode(const struct option *opt,
|
static int parse_opt_signed_tag_mode(const struct option *opt,
|
||||||
const char *arg, int unset)
|
const char *arg, int unset)
|
||||||
|
@ -116,6 +117,9 @@ static void handle_object(const unsigned char *sha1)
|
||||||
char *buf;
|
char *buf;
|
||||||
struct object *object;
|
struct object *object;
|
||||||
|
|
||||||
|
if (no_data)
|
||||||
|
return;
|
||||||
|
|
||||||
if (is_null_sha1(sha1))
|
if (is_null_sha1(sha1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -173,7 +177,7 @@ static void show_filemodify(struct diff_queue_struct *q,
|
||||||
* Links refer to objects in another repositories;
|
* Links refer to objects in another repositories;
|
||||||
* output the SHA-1 verbatim.
|
* output the SHA-1 verbatim.
|
||||||
*/
|
*/
|
||||||
if (S_ISGITLINK(spec->mode))
|
if (no_data || S_ISGITLINK(spec->mode))
|
||||||
printf("M %06o %s %s\n", spec->mode,
|
printf("M %06o %s %s\n", spec->mode,
|
||||||
sha1_to_hex(spec->sha1), spec->path);
|
sha1_to_hex(spec->sha1), spec->path);
|
||||||
else {
|
else {
|
||||||
|
@ -580,6 +584,9 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
|
||||||
"Import marks from this file"),
|
"Import marks from this file"),
|
||||||
OPT_BOOLEAN(0, "fake-missing-tagger", &fake_missing_tagger,
|
OPT_BOOLEAN(0, "fake-missing-tagger", &fake_missing_tagger,
|
||||||
"Fake a tagger when tags lack one"),
|
"Fake a tagger when tags lack one"),
|
||||||
|
{ OPTION_NEGBIT, 0, "data", &no_data, NULL,
|
||||||
|
"Skip output of blob data",
|
||||||
|
PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче