@@ -13,22 +13,22 @@ def test_open_simple
13
13
assert_equal ( g . repo . path , File . join ( @wdir , '.git' ) )
14
14
assert_equal ( g . index . path , File . join ( @wdir , '.git' , 'index' ) )
15
15
end
16
-
17
- def test_open_opts
16
+
17
+ def test_open_opts
18
18
g = Git . open @wdir , :repository => @wbare , :index => @index
19
19
assert_equal ( g . repo . path , @wbare )
20
20
assert_equal ( g . index . path , @index )
21
21
end
22
-
22
+
23
23
def test_git_bare
24
24
g = Git . bare @wbare
25
25
assert_equal ( g . repo . path , @wbare )
26
26
end
27
-
27
+
28
28
#g = Git.init
29
29
# Git.init('project')
30
- # Git.init('/home/schacon/proj',
31
- # { :git_dir => '/opt/git/proj.git',
30
+ # Git.init('/home/schacon/proj',
31
+ # { :git_dir => '/opt/git/proj.git',
32
32
# :index_file => '/tmp/index'} )
33
33
def test_git_init
34
34
in_temp_dir do |path |
@@ -47,55 +47,63 @@ def test_git_init_bare
47
47
assert_equal ( 'true' , repo . config ( 'core.bare' ) )
48
48
end
49
49
end
50
-
50
+
51
51
def test_git_init_remote_git
52
52
in_temp_dir do |dir |
53
53
assert ( !File . exist? ( File . join ( dir , 'config' ) ) )
54
-
55
- in_temp_dir do |path |
54
+
55
+ in_temp_dir do |path |
56
56
Git . init ( path , :repository => dir )
57
57
assert ( File . exist? ( File . join ( dir , 'config' ) ) )
58
58
end
59
59
end
60
60
end
61
-
61
+
62
62
def test_git_clone
63
- in_temp_dir do |path |
63
+ in_temp_dir do |path |
64
64
g = Git . clone ( @wbare , 'bare-co' )
65
65
assert ( File . exist? ( File . join ( g . repo . path , 'config' ) ) )
66
66
assert ( g . dir )
67
67
end
68
68
end
69
-
69
+
70
70
def test_git_clone_with_branch
71
- in_temp_dir do |path |
71
+ in_temp_dir do |path |
72
72
g = Git . clone ( @wbare , 'clone-branch' , :branch => 'test' )
73
73
assert_equal ( g . current_branch , 'test' )
74
74
end
75
75
end
76
-
76
+
77
77
def test_git_clone_bare
78
- in_temp_dir do |path |
78
+ in_temp_dir do |path |
79
79
g = Git . clone ( @wbare , 'bare.git' , :bare => true )
80
80
assert ( File . exist? ( File . join ( g . repo . path , 'config' ) ) )
81
81
assert_nil ( g . dir )
82
82
end
83
83
end
84
84
85
+ def test_git_clone_mirror
86
+ in_temp_dir do |path |
87
+ g = Git . clone ( @wbare , 'bare.git' , :mirror => true )
88
+ assert ( File . exist? ( File . join ( g . repo . path , 'config' ) ) )
89
+ assert_nil ( g . dir )
90
+ end
91
+ end
92
+
85
93
def test_git_clone_config
86
- in_temp_dir do |path |
94
+ in_temp_dir do |path |
87
95
g = Git . clone ( @wbare , 'config.git' , :config => "receive.denyCurrentBranch=ignore" )
88
96
assert_equal ( 'ignore' , g . config [ 'receive.denycurrentbranch' ] )
89
97
assert ( File . exist? ( File . join ( g . repo . path , 'config' ) ) )
90
98
assert ( g . dir )
91
99
end
92
100
end
93
-
101
+
94
102
# trying to open a git project using a bare repo - rather than using Git.repo
95
103
def test_git_open_error
96
104
assert_raise ArgumentError do
97
105
Git . open @wbare
98
106
end
99
107
end
100
-
108
+
101
109
end
0 commit comments