Git 2.45
[git/gitster.git] / t / t9122-git-svn-author.sh
blob0fc289ae0f02c064586b5ff9f1cab0ff0976814f
1 #!/bin/sh
3 test_description='git svn authorship'
5 . ./lib-git-svn.sh
7 test_expect_success 'setup svn repository' '
8 svn_cmd checkout "$svnrepo" work.svn &&
10 cd work.svn &&
11 echo >file &&
12 svn_cmd add file &&
13 svn_cmd commit -m "first commit" file
17 test_expect_success 'interact with it via git svn' '
18 mkdir work.git &&
20 cd work.git &&
21 git svn init "$svnrepo" &&
22 git svn fetch &&
24 echo modification >file &&
25 test_tick &&
26 git commit -a -m second &&
28 test_tick &&
29 git svn dcommit &&
31 echo "further modification" >file &&
32 test_tick &&
33 git commit -a -m third &&
35 test_tick &&
36 git svn --add-author-from dcommit &&
38 echo "yet further modification" >file &&
39 test_tick &&
40 git commit -a -m fourth &&
42 test_tick &&
43 git svn --add-author-from --use-log-author dcommit &&
45 git log &&
47 git show -s HEAD^^ >../actual.2 &&
48 git show -s HEAD^ >../actual.3 &&
49 git show -s HEAD >../actual.4
51 ) &&
53 # Make sure that --add-author-from without --use-log-author
54 # did not affect the authorship information
55 myself=$(grep "^Author: " actual.2) &&
56 unaffected=$(grep "^Author: " actual.3) &&
57 test "z$myself" = "z$unaffected" &&
59 # Make sure lack of --add-author-from did not add cruft
60 ! grep "^ From: A U Thor " actual.2 &&
62 # Make sure --add-author-from added cruft
63 grep "^ From: A U Thor " actual.3 &&
64 grep "^ From: A U Thor " actual.4 &&
66 # Make sure --add-author-from with --use-log-author affected
67 # the authorship information
68 grep "^Author: A U Thor " actual.4 &&
70 # Make sure there are no commit messages with excess blank lines
71 test $(grep "^ " actual.2 | wc -l) = 3 &&
72 test $(grep "^ " actual.3 | wc -l) = 5 &&
73 test $(grep "^ " actual.4 | wc -l) = 5 &&
75 # Make sure there are no svn commit messages with excess blank lines
77 cd work.svn &&
78 svn_cmd up &&
80 test $(svn_cmd log -r2:2 | wc -l) = 5 &&
81 test $(svn_cmd log -r4:4 | wc -l) = 7
85 test_done