Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2009-03-26 02:53:23 +0300
committerJunio C Hamano <gitster@pobox.com>2009-03-26 08:53:45 +0300
commitebeec7dbc564cb83edd8faee87890c47b6f0da43 (patch)
tree986ed08fb1a44f558826a0e7a8efbcb55b68220d /builtin-fast-export.c
parent4fa535a179e771cd5a16d5ab05e97e7bb52739ef (diff)
fast-export: Avoid dropping files from commits
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>
Diffstat (limited to 'builtin-fast-export.c')
-rw-r--r--builtin-fast-export.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9ebd..34a419c38e 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -221,7 +221,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
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);