From f2dc849e9c5fe363ad089f6c3f2b7b3d79fd6a6f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 2 Dec 2007 14:14:13 +0000 Subject: Add 'git fast-export', the sister of 'git fast-import' This program dumps (parts of) a git repository in the format that fast-import understands. For clarity's sake, it does not use the 'inline' method of specifying blobs in the commits, but builds the blobs before building the commits. Since signed tags' signatures will not necessarily be valid (think transformations after the export, or excluding revisions, changing the history), there are 4 modes to handle them: abort (default), ignore, warn and strip. The latter just turns the tags into unsigned ones. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t9301-fast-export.sh | 123 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 t/t9301-fast-export.sh (limited to 't') diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh new file mode 100755 index 000000000..e9c9fe65d --- /dev/null +++ b/t/t9301-fast-export.sh @@ -0,0 +1,123 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git-fast-export' +. ./test-lib.sh + +test_expect_success 'setup' ' + + echo Wohlauf > file && + git add file && + test_tick && + git commit -m initial && + echo die Luft > file && + echo geht frisch > file2 && + git add file file2 && + test_tick && + git commit -m second && + echo und > file2 && + test_tick && + git commit -m third file2 && + test_tick && + git tag rein && + git checkout -b wer HEAD^ && + echo lange > file2 + test_tick && + git commit -m sitzt file2 && + test_tick && + git tag -a -m valentin muss && + git merge -s ours master + +' + +test_expect_success 'fast-export | fast-import' ' + + MASTER=$(git rev-parse --verify master) && + REIN=$(git rev-parse --verify rein) && + WER=$(git rev-parse --verify wer) && + MUSS=$(git rev-parse --verify muss) && + mkdir new && + git --git-dir=new/.git init && + git fast-export --all | + (cd new && + git fast-import && + test $MASTER = $(git rev-parse --verify refs/heads/master) && + test $REIN = $(git rev-parse --verify refs/tags/rein) && + test $WER = $(git rev-parse --verify refs/heads/wer) && + test $MUSS = $(git rev-parse --verify refs/tags/muss)) + +' + +test_expect_success 'fast-export master~2..master' ' + + git fast-export master~2..master | + sed "s/master/partial/" | + (cd new && + git fast-import && + test $MASTER != $(git rev-parse --verify refs/heads/partial) && + git diff master..partial && + git diff master^..partial^ && + ! git rev-parse partial~2) + +' + +test_expect_success 'iso-8859-1' ' + + git config i18n.commitencoding ISO-8859-1 && + # use author and committer name in ISO-8859-1 to match it. + . ../t3901-8859-1.txt && + test_tick && + echo rosten >file && + git commit -s -m den file && + git fast-export wer^..wer | + sed "s/wer/i18n/" | + (cd new && + git fast-import && + git cat-file commit i18n | grep "Áéí óú") + +' + +cat > signed-tag-import << EOF +tag sign-your-name +from $(git rev-parse HEAD) +tagger C O Mitter 1112911993 -0700 +data 210 +A message for a sign +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.5 (GNU/Linux) + +fakedsignaturefakedsignaturefakedsignaturefakedsignaturfakedsign +aturefakedsignaturefake= +=/59v +-----END PGP SIGNATURE----- +EOF + +test_expect_success 'set up faked signed tag' ' + + cat signed-tag-import | git fast-import + +' + +test_expect_success 'signed-tags=abort' ' + + ! git fast-export --signed-tags=abort sign-your-name + +' + +test_expect_success 'signed-tags=ignore' ' + + git fast-export --signed-tags=ignore sign-your-name > output && + grep PGP output + +' + +test_expect_success 'signed-tags=strip' ' + + git fast-export --signed-tags=strip sign-your-name > output && + ! grep PGP output + +' + +test_done -- cgit v1.2.1