]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9122-git-svn-author.sh
The third batch
[thirdparty/git.git] / t / t9122-git-svn-author.sh
1 #!/bin/sh
2
3 test_description='git svn authorship'
4
5 . ./lib-git-svn.sh
6
7 test_expect_success 'setup svn repository' '
8 svn_cmd checkout "$svnrepo" work.svn &&
9 (
10 cd work.svn &&
11 echo >file &&
12 svn_cmd add file &&
13 svn_cmd commit -m "first commit" file
14 )
15 '
16
17 test_expect_success 'interact with it via git svn' '
18 mkdir work.git &&
19 (
20 cd work.git &&
21 git svn init "$svnrepo" &&
22 git svn fetch &&
23
24 echo modification >file &&
25 test_tick &&
26 git commit -a -m second &&
27
28 test_tick &&
29 git svn dcommit &&
30
31 echo "further modification" >file &&
32 test_tick &&
33 git commit -a -m third &&
34
35 test_tick &&
36 git svn --add-author-from dcommit &&
37
38 echo "yet further modification" >file &&
39 test_tick &&
40 git commit -a -m fourth &&
41
42 test_tick &&
43 git svn --add-author-from --use-log-author dcommit &&
44
45 git log &&
46
47 git show -s HEAD^^ >../actual.2 &&
48 git show -s HEAD^ >../actual.3 &&
49 git show -s HEAD >../actual.4
50
51 ) &&
52
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" &&
58
59 # Make sure lack of --add-author-from did not add cruft
60 ! grep "^ From: A U Thor " actual.2 &&
61
62 # Make sure --add-author-from added cruft
63 grep "^ From: A U Thor " actual.3 &&
64 grep "^ From: A U Thor " actual.4 &&
65
66 # Make sure --add-author-from with --use-log-author affected
67 # the authorship information
68 grep "^Author: A U Thor " actual.4 &&
69
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 &&
74
75 # Make sure there are no svn commit messages with excess blank lines
76 (
77 cd work.svn &&
78 svn_cmd up &&
79
80 test $(svn_cmd log -r2:2 | wc -l) = 5 &&
81 test $(svn_cmd log -r4:4 | wc -l) = 7
82 )
83 '
84
85 test_done