summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4fa535a)
raw | patch | inline | side by side (parent: 4fa535a)
author | Elijah Newren <newren@gmail.com> | |
Wed, 25 Mar 2009 23:53:23 +0000 (17:53 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 26 Mar 2009 05:53:45 +0000 (22:53 -0700) |
When exporting a subset of commits on a branch that do not go back to a
root commit (e.g. master~2..master), we still want each exported commit to
have the same files in the exported tree as in the original tree.
Previously, when given such a range, we would omit master~2 as a parent of
master~1, but we would still diff against master~2 when selecting the list
of files to include in master~1. This would result in only files that
had changed in the given range showing up in the resulting export. In such
cases, we should diff master~1 against the root instead (i.e. use
diff_root_tree_sha1 instead of diff_tree_sha1).
There's a special case to consider here: incremental exports (i.e. exports
where the --import-marks flag is specified). If master~2 is an imported
mark, then we still want to diff master~1 against master~2 when selecting
the list of files to include.
We can handle all cases, including the special case, by just checking
whether master~2 corresponds to a known object mark when deciding what to
diff against.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
root commit (e.g. master~2..master), we still want each exported commit to
have the same files in the exported tree as in the original tree.
Previously, when given such a range, we would omit master~2 as a parent of
master~1, but we would still diff against master~2 when selecting the list
of files to include in master~1. This would result in only files that
had changed in the given range showing up in the resulting export. In such
cases, we should diff master~1 against the root instead (i.e. use
diff_root_tree_sha1 instead of diff_tree_sha1).
There's a special case to consider here: incremental exports (i.e. exports
where the --import-marks flag is specified). If master~2 is an imported
mark, then we still want to diff master~1 against master~2 when selecting
the list of files to include.
We can handle all cases, including the special case, by just checking
whether master~2 corresponds to a known object mark when deciding what to
diff against.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fast-export.c | patch | blob | history | |
t/t9301-fast-export.sh | patch | blob | history |
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9ebdba7832a0ac736d56a7b564bba41baa..34a419c38e15998e82c9daf5627154d491e1af04 100644 (file)
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
if (message)
message += 2;
- if (commit->parents) {
+ if (commit->parents &&
+ get_object_mark(&commit->parents->item->object) != 0) {
parse_commit(commit->parents->item);
diff_tree_sha1(commit->parents->item->tree->object.sha1,
commit->tree->object.sha1, "", &rev->diffopt);
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 86c376088ccd04d0b0cbb14424eef7a9b89b45d3..b860626bee818d77509022d67121b37eab0ced07 100755 (executable)
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
test_expect_success 'setup' '
+ echo break it > file0 &&
+ git add file0 &&
+ test_tick &&
echo Wohlauf > file &&
git add file &&
test_tick &&
(cd new &&
git fast-import &&
test $MASTER != $(git rev-parse --verify refs/heads/partial) &&
- git diff master..partial &&
- git diff master^..partial^ &&
+ git diff --exit-code master partial &&
+ git diff --exit-code master^ partial^ &&
test_must_fail git rev-parse partial~2)
'