2008-05-13 02:09:49 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='git svn authorship'
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
test_expect_success 'setup svn repository' '
|
2009-05-08 10:06:16 +02:00
|
|
|
svn_cmd checkout "$svnrepo" work.svn &&
|
2008-05-13 02:09:49 +02:00
|
|
|
(
|
|
|
|
cd work.svn &&
|
2018-07-02 02:24:04 +02:00
|
|
|
echo >file &&
|
|
|
|
svn_cmd add file &&
|
2009-05-08 10:06:16 +02:00
|
|
|
svn_cmd commit -m "first commit" file
|
2008-05-13 02:09:49 +02:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2008-09-09 23:25:27 +02:00
|
|
|
test_expect_success 'interact with it via git svn' '
|
2008-05-13 02:09:49 +02:00
|
|
|
mkdir work.git &&
|
|
|
|
(
|
|
|
|
cd work.git &&
|
2018-07-02 02:24:04 +02:00
|
|
|
git svn init "$svnrepo" &&
|
2008-05-13 02:09:49 +02:00
|
|
|
git svn fetch &&
|
|
|
|
|
|
|
|
echo modification >file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -a -m second &&
|
|
|
|
|
|
|
|
test_tick &&
|
|
|
|
git svn dcommit &&
|
|
|
|
|
|
|
|
echo "further modification" >file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -a -m third &&
|
|
|
|
|
|
|
|
test_tick &&
|
|
|
|
git svn --add-author-from dcommit &&
|
|
|
|
|
|
|
|
echo "yet further modification" >file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -a -m fourth &&
|
|
|
|
|
|
|
|
test_tick &&
|
|
|
|
git svn --add-author-from --use-log-author dcommit &&
|
|
|
|
|
|
|
|
git log &&
|
|
|
|
|
|
|
|
git show -s HEAD^^ >../actual.2 &&
|
|
|
|
git show -s HEAD^ >../actual.3 &&
|
|
|
|
git show -s HEAD >../actual.4
|
|
|
|
|
|
|
|
) &&
|
|
|
|
|
|
|
|
# Make sure that --add-author-from without --use-log-author
|
|
|
|
# did not affect the authorship information
|
|
|
|
myself=$(grep "^Author: " actual.2) &&
|
|
|
|
unaffected=$(grep "^Author: " actual.3) &&
|
|
|
|
test "z$myself" = "z$unaffected" &&
|
|
|
|
|
|
|
|
# Make sure lack of --add-author-from did not add cruft
|
|
|
|
! grep "^ From: A U Thor " actual.2 &&
|
|
|
|
|
|
|
|
# Make sure --add-author-from added cruft
|
|
|
|
grep "^ From: A U Thor " actual.3 &&
|
|
|
|
grep "^ From: A U Thor " actual.4 &&
|
|
|
|
|
|
|
|
# Make sure --add-author-from with --use-log-author affected
|
|
|
|
# the authorship information
|
2008-06-13 01:10:51 +02:00
|
|
|
grep "^Author: A U Thor " actual.4 &&
|
|
|
|
|
|
|
|
# Make sure there are no commit messages with excess blank lines
|
|
|
|
test $(grep "^ " actual.2 | wc -l) = 3 &&
|
|
|
|
test $(grep "^ " actual.3 | wc -l) = 5 &&
|
|
|
|
test $(grep "^ " actual.4 | wc -l) = 5 &&
|
|
|
|
|
|
|
|
# Make sure there are no svn commit messages with excess blank lines
|
|
|
|
(
|
|
|
|
cd work.svn &&
|
2009-05-08 10:06:16 +02:00
|
|
|
svn_cmd up &&
|
2008-06-13 01:10:51 +02:00
|
|
|
|
2009-05-08 10:06:16 +02:00
|
|
|
test $(svn_cmd log -r2:2 | wc -l) = 5 &&
|
|
|
|
test $(svn_cmd log -r4:4 | wc -l) = 7
|
2008-06-13 01:10:51 +02:00
|
|
|
)
|
2008-05-13 02:09:49 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|