]>
Commit | Line | Data |
---|---|---|
27554e90 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='git svn authorship' | |
7a98d9ab ÆAB |
4 | |
5 | TEST_FAILS_SANITIZE_LEAK=true | |
27554e90 JH |
6 | . ./lib-git-svn.sh |
7 | ||
8 | test_expect_success 'setup svn repository' ' | |
da083d68 | 9 | svn_cmd checkout "$svnrepo" work.svn && |
27554e90 JH |
10 | ( |
11 | cd work.svn && | |
cff4243d ES |
12 | echo >file && |
13 | svn_cmd add file && | |
da083d68 | 14 | svn_cmd commit -m "first commit" file |
27554e90 JH |
15 | ) |
16 | ' | |
17 | ||
f964732c | 18 | test_expect_success 'interact with it via git svn' ' |
27554e90 JH |
19 | mkdir work.git && |
20 | ( | |
21 | cd work.git && | |
cff4243d | 22 | git svn init "$svnrepo" && |
27554e90 JH |
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 | |
c8c6a2ec AP |
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 && | |
da083d68 | 79 | svn_cmd up && |
c8c6a2ec | 80 | |
da083d68 ER |
81 | test $(svn_cmd log -r2:2 | wc -l) = 5 && |
82 | test $(svn_cmd log -r4:4 | wc -l) = 7 | |
c8c6a2ec | 83 | ) |
27554e90 JH |
84 | ' |
85 | ||
86 | test_done |