Merge branch 'en/fast-export-fix'
* en/fast-export-fix: fast-export: Add a --full-tree option fast-export: Fix dropping of files with --import-marks and path limitingmaint
commit
1253164c8b
|
@ -90,6 +90,12 @@ marks the same across runs.
|
||||||
resulting stream can only be used by a repository which
|
resulting stream can only be used by a repository which
|
||||||
already contains the necessary objects.
|
already contains the necessary objects.
|
||||||
|
|
||||||
|
--full-tree::
|
||||||
|
This option will cause fast-export to issue a "deleteall"
|
||||||
|
directive for each commit followed by a full list of all files
|
||||||
|
in the commit (as opposed to just listing the files which are
|
||||||
|
different from the commit's first parent).
|
||||||
|
|
||||||
[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
|
||||||
|
|
|
@ -27,6 +27,7 @@ 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 no_data;
|
||||||
|
static int full_tree;
|
||||||
|
|
||||||
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)
|
||||||
|
@ -241,7 +242,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
|
||||||
message += 2;
|
message += 2;
|
||||||
|
|
||||||
if (commit->parents &&
|
if (commit->parents &&
|
||||||
get_object_mark(&commit->parents->item->object) != 0) {
|
get_object_mark(&commit->parents->item->object) != 0 &&
|
||||||
|
!full_tree) {
|
||||||
parse_commit(commit->parents->item);
|
parse_commit(commit->parents->item);
|
||||||
diff_tree_sha1(commit->parents->item->tree->object.sha1,
|
diff_tree_sha1(commit->parents->item->tree->object.sha1,
|
||||||
commit->tree->object.sha1, "", &rev->diffopt);
|
commit->tree->object.sha1, "", &rev->diffopt);
|
||||||
|
@ -281,6 +283,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (full_tree)
|
||||||
|
printf("deleteall\n");
|
||||||
log_tree_diff_flush(rev);
|
log_tree_diff_flush(rev);
|
||||||
rev->diffopt.output_format = saved_output_format;
|
rev->diffopt.output_format = saved_output_format;
|
||||||
|
|
||||||
|
@ -584,6 +588,8 @@ 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"),
|
||||||
|
OPT_BOOLEAN(0, "full-tree", &full_tree,
|
||||||
|
"Output full tree for each commit"),
|
||||||
{ OPTION_NEGBIT, 0, "data", &no_data, NULL,
|
{ OPTION_NEGBIT, 0, "data", &no_data, NULL,
|
||||||
"Skip output of blob data",
|
"Skip output of blob data",
|
||||||
PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
|
PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
|
||||||
|
@ -608,6 +614,9 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
|
||||||
if (import_filename)
|
if (import_filename)
|
||||||
import_marks(import_filename);
|
import_marks(import_filename);
|
||||||
|
|
||||||
|
if (import_filename && revs.prune_data)
|
||||||
|
full_tree = 1;
|
||||||
|
|
||||||
get_tags_and_duplicates(&revs.pending, &extra_refs);
|
get_tags_and_duplicates(&revs.pending, &extra_refs);
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
|
|
|
@ -355,6 +355,20 @@ test_expect_failure 'no exact-ref revisions included' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'path limiting with import-marks does not lose unmodified files' '
|
||||||
|
git checkout -b simple marks~2 &&
|
||||||
|
git fast-export --export-marks=marks simple -- file > /dev/null &&
|
||||||
|
echo more content >> file &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -mnext file &&
|
||||||
|
git fast-export --import-marks=marks simple -- file file0 | grep file0
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'full-tree re-shows unmodified files' '
|
||||||
|
git checkout -f simple &&
|
||||||
|
test $(git fast-export --full-tree simple | grep -c file0) -eq 3
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'set-up a few more tags for tag export tests' '
|
test_expect_success 'set-up a few more tags for tag export tests' '
|
||||||
git checkout -f master &&
|
git checkout -f master &&
|
||||||
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
|
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
|
||||||
|
|
Loading…
Reference in New Issue