@@ -67,7 +67,7 @@ def setUpClass(self):
67
67
# create a "remote" repo
68
68
subprocess .check_call ("git init" , shell = True , cwd = self .remote_path )
69
69
subprocess .check_call ("touch fixed.txt" , shell = True , cwd = self .remote_path )
70
- subprocess .check_call ("git add * " , shell = True , cwd = self .remote_path )
70
+ subprocess .check_call ("git add fixed.txt " , shell = True , cwd = self .remote_path )
71
71
subprocess .check_call ("git commit -m initial" , shell = True , cwd = self .remote_path )
72
72
subprocess .check_call ("git tag test_tag" , shell = True , cwd = self .remote_path )
73
73
subprocess .check_call ("git branch test_branch" , shell = True , cwd = self .remote_path )
@@ -111,7 +111,7 @@ def setUpClass(self):
111
111
subprocess .check_call ("git tag last_tag" , shell = True , cwd = self .remote_path )
112
112
113
113
# attach submodule somewhere else in test_branch
114
- subprocess .check_call ("git checkout test_branch " , shell = True , cwd = self .remote_path )
114
+ subprocess .check_call ("git checkout master -b test_branch2 " , shell = True , cwd = self .remote_path )
115
115
subprocess .check_call ("git submodule add %s %s" % (self .submodule_path , "submodule2" ), shell = True , cwd = self .remote_path )
116
116
subprocess .check_call ("git submodule init" , shell = True , cwd = self .remote_path )
117
117
subprocess .check_call ("git submodule update" , shell = True , cwd = self .remote_path )
@@ -142,13 +142,26 @@ def test_checkout_master_with_subs(self):
142
142
self .assertTrue (client .checkout (url ))
143
143
self .assertTrue (client .path_exists ())
144
144
self .assertTrue (client .detect_presence ())
145
- self .assertEqual (client .get_version (), self . version_final )
145
+ self .assertEqual (self . version_final , client .get_version ())
146
146
self .assertTrue (subclient .path_exists ())
147
147
self .assertTrue (subclient .detect_presence ())
148
- self .assertEqual (subclient .get_version (), self . subversion_final )
148
+ self .assertEqual (self . subversion_final , subclient .get_version ())
149
149
self .assertTrue (subsubclient .path_exists ())
150
150
self .assertTrue (subsubclient .detect_presence ())
151
- self .assertEqual (subsubclient .get_version (), self .subsubversion_final )
151
+ self .assertEqual (self .subsubversion_final , subsubclient .get_version ())
152
+
153
+ def test_checkout_branch_with_subs (self ):
154
+ url = self .remote_path
155
+ client = GitClient (self .local_path )
156
+ subclient = GitClient (self .sublocal_path )
157
+ subsubclient = GitClient (self .subsublocal_path )
158
+ self .assertFalse (client .path_exists ())
159
+ self .assertFalse (client .detect_presence ())
160
+ self .assertTrue (client .checkout (url , refname = 'test_branch' ))
161
+ self .assertTrue (client .path_exists ())
162
+ self .assertTrue (client .detect_presence ())
163
+ self .assertEqual (self .version_init , client .get_version ())
164
+ self .assertFalse (subclient .path_exists ())
152
165
153
166
def test_switch_branches (self ):
154
167
url = self .remote_path
@@ -163,7 +176,7 @@ def test_switch_branches(self):
163
176
self .assertTrue (subclient .path_exists ())
164
177
self .assertTrue (subsubclient .path_exists ())
165
178
self .assertFalse (subclient2 .path_exists ())
166
- new_version = "test_branch "
179
+ new_version = "test_branch2 "
167
180
self .assertTrue (client .update (new_version ))
168
181
self .assertTrue (subclient2 .path_exists ())
169
182
0 commit comments