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