fi
check () {
- (cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD) > actual &&
- (echo $2 &&
- echo "refs/heads/$3") > expected &&
+ echo $3 > expected &&
+ git --git-dir=$1/.git log --format='%s' -1 $2 > actual
test_cmp expected actual
}
bzr whoami "A U Thor <author@example.com>"
test_expect_success 'cloning' '
- (bzr init bzrrepo &&
+ (
+ bzr init bzrrepo &&
cd bzrrepo &&
echo one > content &&
bzr add content &&
bzr commit -m one
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
- check gitrepo one master
+ git clone "bzr::bzrrepo" gitrepo &&
+ check gitrepo HEAD one
'
test_expect_success 'pulling' '
- (cd bzrrepo &&
+ (
+ cd bzrrepo &&
echo two > content &&
bzr commit -m two
) &&
(cd gitrepo && git pull) &&
- check gitrepo two master
+ check gitrepo HEAD two
'
test_expect_success 'pushing' '
- (cd gitrepo &&
+ (
+ cd gitrepo &&
echo three > content &&
git commit -a -m three &&
git push
'
test_expect_success 'roundtrip' '
- (cd gitrepo &&
+ (
+ cd gitrepo &&
git pull &&
- git log --format="%s" -1 origin/master > actual) &&
+ git log --format="%s" -1 origin/master > actual
+ ) &&
echo three > expected &&
test_cmp expected actual &&
(cd gitrepo && git push && git pull) &&
- (cd bzrrepo &&
+ (
+ cd bzrrepo &&
echo four > content &&
bzr commit -m four
) &&
(cd gitrepo && git pull && git push) &&
- check gitrepo four master &&
+ check gitrepo HEAD four &&
- (cd gitrepo &&
+ (
+ cd gitrepo &&
echo five > content &&
git commit -a -m five &&
git push && git pull
EOF
test_expect_success 'special modes' '
- (cd bzrrepo &&
+ (
+ cd bzrrepo &&
echo exec > executable
chmod +x executable &&
bzr add executable
bzr commit -m link &&
mkdir dir &&
bzr add dir &&
- bzr commit -m dir) &&
+ bzr commit -m dir
+ ) &&
- (cd gitrepo &&
+ (
+ cd gitrepo &&
git pull
- git ls-tree HEAD > ../actual) &&
+ git ls-tree HEAD > ../actual
+ ) &&
test_cmp expected actual &&
- (cd gitrepo &&
- git cat-file -p HEAD:link > ../actual) &&
+ (
+ cd gitrepo &&
+ git cat-file -p HEAD:link > ../actual
+ ) &&
printf content > expected &&
test_cmp expected actual
EOF
test_expect_success 'moving directory' '
- (cd bzrrepo &&
+ (
+ cd bzrrepo &&
mkdir movedir &&
echo one > movedir/one &&
echo two > movedir/two &&
bzr add movedir &&
bzr commit -m movedir &&
bzr mv movedir movedir-new &&
- bzr commit -m movedir-new) &&
+ bzr commit -m movedir-new
+ ) &&
- (cd gitrepo &&
+ (
+ cd gitrepo &&
git pull &&
- git ls-tree HEAD > ../actual) &&
+ git ls-tree HEAD > ../actual
+ ) &&
test_cmp expected actual
'
test_expect_success 'different authors' '
- (cd bzrrepo &&
+ (
+ cd bzrrepo &&
echo john >> content &&
bzr commit -m john \
--author "Jane Rey <jrey@example.com>" \
- --author "John Doe <jdoe@example.com>") &&
+ --author "John Doe <jdoe@example.com>"
+ ) &&
- (cd gitrepo &&
+ (
+ cd gitrepo &&
git pull &&
- git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
+ git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
+ ) &&
echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
test_cmp expected actual
'
+# cleanup previous stuff
+rm -rf bzrrepo gitrepo
+
test_expect_success 'fetch utf-8 filenames' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+ test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
+
(
bzr init bzrrepo &&
cd bzrrepo &&
) &&
(
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git -c core.quotepath=false ls-files > ../actual
) &&
'
test_expect_success 'push utf-8 filenames' '
+ test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
+
mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
) &&
(
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
echo test >> "ærø" &&
'
test_expect_success 'pushing a merge' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&
bzr commit -m one
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
(
cd bzrrepo &&
EOF
test_expect_success 'proper bzr repo' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
bzr init-repo bzrrepo &&
- bzr init bzrrepo/trunk &&
(
+ bzr init bzrrepo/trunk &&
cd bzrrepo/trunk &&
echo one >> content &&
bzr add content &&
bzr commit -m one
) &&
- bzr branch bzrrepo/trunk bzrrepo/branch &&
(
+ bzr branch bzrrepo/trunk bzrrepo/branch &&
cd bzrrepo/branch &&
echo two >> content &&
bzr commit -m one
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
(
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
) &&
- test_cmp ../expected actual
+ test_cmp expected actual
'
test_expect_success 'strip' '
- # Do not imitate this style; always chdir inside a subshell instead
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&
bzr commit -m two
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
(
cd bzrrepo &&
bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
) &&
- (cd gitrepo &&
+ (
+ cd gitrepo &&
git fetch &&
- git log --format="%an %ad %s" --date=short origin/master > ../actual) &&
+ git log --format="%an %ad %s" --date=short origin/master > ../actual
+ ) &&
test_cmp expected actual
'