Junio C Hamano | 27554e9 | 2008-05-12 17:09:49 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git svn authorship' |
| 4 | . ./lib-git-svn.sh |
| 5 | |
| 6 | test_expect_success 'setup svn repository' ' |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 7 | svn_cmd checkout "$svnrepo" work.svn && |
Junio C Hamano | 27554e9 | 2008-05-12 17:09:49 -0700 | [diff] [blame] | 8 | ( |
| 9 | cd work.svn && |
| 10 | echo >file |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 11 | svn_cmd add file |
| 12 | svn_cmd commit -m "first commit" file |
Junio C Hamano | 27554e9 | 2008-05-12 17:09:49 -0700 | [diff] [blame] | 13 | ) |
| 14 | ' |
| 15 | |
Nanako Shiraishi | f964732 | 2008-09-10 06:25:27 +0900 | [diff] [blame] | 16 | test_expect_success 'interact with it via git svn' ' |
Junio C Hamano | 27554e9 | 2008-05-12 17:09:49 -0700 | [diff] [blame] | 17 | mkdir work.git && |
| 18 | ( |
| 19 | cd work.git && |
| 20 | git svn init "$svnrepo" |
| 21 | git svn fetch && |
| 22 | |
| 23 | echo modification >file && |
| 24 | test_tick && |
| 25 | git commit -a -m second && |
| 26 | |
| 27 | test_tick && |
| 28 | git svn dcommit && |
| 29 | |
| 30 | echo "further modification" >file && |
| 31 | test_tick && |
| 32 | git commit -a -m third && |
| 33 | |
| 34 | test_tick && |
| 35 | git svn --add-author-from dcommit && |
| 36 | |
| 37 | echo "yet further modification" >file && |
| 38 | test_tick && |
| 39 | git commit -a -m fourth && |
| 40 | |
| 41 | test_tick && |
| 42 | git svn --add-author-from --use-log-author dcommit && |
| 43 | |
| 44 | git log && |
| 45 | |
| 46 | git show -s HEAD^^ >../actual.2 && |
| 47 | git show -s HEAD^ >../actual.3 && |
| 48 | git show -s HEAD >../actual.4 |
| 49 | |
| 50 | ) && |
| 51 | |
| 52 | # Make sure that --add-author-from without --use-log-author |
| 53 | # did not affect the authorship information |
| 54 | myself=$(grep "^Author: " actual.2) && |
| 55 | unaffected=$(grep "^Author: " actual.3) && |
| 56 | test "z$myself" = "z$unaffected" && |
| 57 | |
| 58 | # Make sure lack of --add-author-from did not add cruft |
| 59 | ! grep "^ From: A U Thor " actual.2 && |
| 60 | |
| 61 | # Make sure --add-author-from added cruft |
| 62 | grep "^ From: A U Thor " actual.3 && |
| 63 | grep "^ From: A U Thor " actual.4 && |
| 64 | |
| 65 | # Make sure --add-author-from with --use-log-author affected |
| 66 | # the authorship information |
Avery Pennarun | c8c6a2e | 2008-06-12 19:10:51 -0400 | [diff] [blame] | 67 | grep "^Author: A U Thor " actual.4 && |
| 68 | |
| 69 | # Make sure there are no commit messages with excess blank lines |
| 70 | test $(grep "^ " actual.2 | wc -l) = 3 && |
| 71 | test $(grep "^ " actual.3 | wc -l) = 5 && |
| 72 | test $(grep "^ " actual.4 | wc -l) = 5 && |
| 73 | |
| 74 | # Make sure there are no svn commit messages with excess blank lines |
| 75 | ( |
| 76 | cd work.svn && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 77 | svn_cmd up && |
Avery Pennarun | c8c6a2e | 2008-06-12 19:10:51 -0400 | [diff] [blame] | 78 | |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 79 | test $(svn_cmd log -r2:2 | wc -l) = 5 && |
| 80 | test $(svn_cmd log -r4:4 | wc -l) = 7 |
Avery Pennarun | c8c6a2e | 2008-06-12 19:10:51 -0400 | [diff] [blame] | 81 | ) |
Junio C Hamano | 27554e9 | 2008-05-12 17:09:49 -0700 | [diff] [blame] | 82 | ' |
| 83 | |
| 84 | test_done |