From: newren@gmail.com
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de, gitster@pobox.com,
Elijah Newren <newren@gmail.com>
Subject: [PATCH] fast-export: Avoid dropping files from commits
Date: Wed, 25 Mar 2009 14:55:19 -0600 [thread overview]
Message-ID: <1238014519-11683-1-git-send-email-newren@gmail.com> (raw)
From: Elijah Newren <newren@gmail.com>
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.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
builtin-fast-export.c | 3 ++-
t/t9301-fast-export.sh | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9..34a419c 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);
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 86c3760..b860626 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -8,6 +8,9 @@ test_description='git fast-export'
test_expect_success 'setup' '
+ echo break it > file0 &&
+ git add file0 &&
+ test_tick &&
echo Wohlauf > file &&
git add file &&
test_tick &&
@@ -57,8 +60,8 @@ test_expect_success 'fast-export master~2..master' '
(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)
'
--
1.6.0.6
next reply other threads:[~2009-03-25 20:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 20:55 newren [this message]
2009-03-25 22:13 ` [PATCH] fast-export: Avoid dropping files from commits Johannes Schindelin
2009-03-25 23:53 ` newren
2009-03-26 0:06 ` Elijah Newren
2009-03-26 0:40 ` Johannes Schindelin
2009-03-26 3:36 ` Junio C Hamano
2009-03-26 4:02 ` Elijah Newren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1238014519-11683-1-git-send-email-newren@gmail.com \
--to=newren@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.