summaryrefslogtreecommitdiff
path: root/t/t9350-fast-export.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-11-16 07:59:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-17 09:43:52 (GMT)
commit530ca19c02b1fa1d13195d24fc76c2926ceecdc2 (patch)
treeeb088bd25a5e026e1d28c0b7d84a692595e507c5 /t/t9350-fast-export.sh
parentfdf31b6369a4c66a2db743ee480f97daa239fc81 (diff)
downloadgit-530ca19c02b1fa1d13195d24fc76c2926ceecdc2.zip
git-530ca19c02b1fa1d13195d24fc76c2926ceecdc2.tar.gz
git-530ca19c02b1fa1d13195d24fc76c2926ceecdc2.tar.bz2
fast-export: add --reference-excluded-parents option
git filter-branch has a nifty feature allowing you to rewrite, e.g. just the last 8 commits of a linear history git filter-branch $OPTIONS HEAD~8..HEAD If you try the same with git fast-export, you instead get a history of only 8 commits, with HEAD~7 being rewritten into a root commit. There are two alternatives: 1) Don't use the negative revision specification, and when you're filtering the output to make modifications to the last 8 commits, just be careful to not modify any earlier commits somehow. 2) First run 'git fast-export --export-marks=somefile HEAD~8', then run 'git fast-export --import-marks=somefile HEAD~8..HEAD'. Both are more error prone than I'd like (the first for obvious reasons; with the second option I have sometimes accidentally included too many revisions in the first command and then found that the corresponding extra revisions were not exported by the second command and thus were not modified as I expected). Also, both are poor from a performance perspective. Add a new --reference-excluded-parents option which will cause fast-export to refer to commits outside the specified rev-list-args range by their sha1sum. Such a stream will only be useful in a repository which already contains the necessary commits (much like the restriction imposed when using --no-data). Note from Peff: I think we might be able to do a little more optimization here. If we're exporting HEAD^..HEAD and there's an object in HEAD^ which is unchanged in HEAD, I think we'd still print it (because it would not be marked SHOWN), but we could omit it (by walking the tree of the boundary commits and marking them shown). I don't think it's a blocker for what you're doing here, but just a possible future optimization. Signed-off-by: Elijah Newren <newren@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9350-fast-export.sh')
-rwxr-xr-xt/t9350-fast-export.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 50c2fce..d7d7306 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -66,6 +66,17 @@ test_expect_success 'fast-export master~2..master' '
'
+test_expect_success 'fast-export --reference-excluded-parents master~2..master' '
+
+ git fast-export --reference-excluded-parents master~2..master >actual &&
+ grep commit.refs/heads/master actual >commit-count &&
+ test_line_count = 2 commit-count &&
+ sed "s/master/rewrite/" actual |
+ (cd new &&
+ git fast-import &&
+ test $MASTER = $(git rev-parse --verify refs/heads/rewrite))
+'
+
test_expect_success 'iso-8859-1' '
git config i18n.commitencoding ISO8859-1 &&