@@ -39,21 +39,10 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte
39
39
40
40
fixture . Repository . CreateBranch ( SpecificBranchName ) ;
41
41
42
- var arguments = new Arguments
43
- {
44
- TargetPath = tempDir ,
45
- TargetUrl = fixture . RepositoryPath
46
- } ;
47
-
48
42
// Copy contents into working directory
49
43
File . Copy ( Path . Combine ( fixture . RepositoryPath , "TestFile.txt" ) , Path . Combine ( tempDir , "TestFile.txt" ) ) ;
50
44
51
- if ( ! string . IsNullOrWhiteSpace ( branchName ) )
52
- {
53
- arguments . TargetBranch = branchName ;
54
- }
55
-
56
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
45
+ var gitPreparer = new GitPreparer ( fixture . RepositoryPath , null , new Authentication ( ) , branchName , false , tempDir ) ;
57
46
gitPreparer . Initialise ( false , null ) ;
58
47
dynamicRepositoryPath = gitPreparer . GetDotGitDirectory ( ) ;
59
48
@@ -91,14 +80,7 @@ public void UpdatesExistingDynamicRepository()
91
80
{
92
81
mainRepositoryFixture . Repository . MakeCommits ( 1 ) ;
93
82
94
- var arguments = new Arguments
95
- {
96
- TargetPath = tempDir ,
97
- TargetUrl = mainRepositoryFixture . RepositoryPath ,
98
- TargetBranch = "master"
99
- } ;
100
-
101
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
83
+ var gitPreparer = new GitPreparer ( mainRepositoryFixture . RepositoryPath , null , new Authentication ( ) , "master" , false , tempDir ) ;
102
84
gitPreparer . Initialise ( false , null ) ;
103
85
dynamicRepositoryPath = gitPreparer . GetDotGitDirectory ( ) ;
104
86
@@ -139,13 +121,7 @@ public void PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken()
139
121
expectedDynamicRepoLocation = Path . Combine ( tempPath , fixture . RepositoryPath . Split ( '\\ ' ) . Last ( ) ) ;
140
122
Directory . CreateDirectory ( expectedDynamicRepoLocation ) ;
141
123
142
- var arguments = new Arguments
143
- {
144
- TargetPath = tempDir ,
145
- TargetUrl = fixture . RepositoryPath
146
- } ;
147
-
148
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
124
+ var gitPreparer = new GitPreparer ( fixture . RepositoryPath , null , new Authentication ( ) , null , false , tempDir ) ;
149
125
gitPreparer . Initialise ( false , null ) ;
150
126
151
127
gitPreparer . IsDynamicGitRepository . ShouldBe ( true ) ;
@@ -166,46 +142,13 @@ public void PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken()
166
142
public void WorksCorrectlyWithLocalRepository ( )
167
143
{
168
144
var tempDir = Path . GetTempPath ( ) ;
169
-
170
- var arguments = new Arguments
171
- {
172
- TargetPath = tempDir
173
- } ;
174
-
175
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
145
+ var gitPreparer = new GitPreparer ( null , null , null , null , false , tempDir ) ;
176
146
var dynamicRepositoryPath = gitPreparer . GetDotGitDirectory ( ) ;
177
147
178
148
dynamicRepositoryPath . ShouldBe ( null ) ;
179
149
gitPreparer . IsDynamicGitRepository . ShouldBe ( false ) ;
180
150
}
181
151
182
- [ Test ]
183
- public void UsesGitVersionConfigWhenCreatingDynamicRepository ( )
184
- {
185
- var localRepoPath = PathHelper . GetTempPath ( ) ;
186
- var repoBasePath = Path . GetDirectoryName ( PathHelper . GetTempPath ( ) ) ;
187
- Directory . CreateDirectory ( localRepoPath ) ;
188
-
189
- try
190
- {
191
- using ( var remote = new EmptyRepositoryFixture ( new Config ( ) ) )
192
- {
193
- remote . Repository . MakeACommit ( ) ;
194
- var configFile = Path . Combine ( localRepoPath , "GitVersionConfig.yaml" ) ;
195
- File . WriteAllText ( configFile , "next-version: 1.0.0" ) ;
196
-
197
- var arguments = string . Format ( " /url {0} /dynamicRepoLocation {1}" , remote . RepositoryPath , repoBasePath ) ;
198
- var results = GitVersionHelper . ExecuteIn ( localRepoPath , arguments , false ) ;
199
- results . OutputVariables . SemVer . ShouldBe ( "1.0.0" ) ;
200
- }
201
- }
202
- finally
203
- {
204
- DeleteHelper . DeleteGitRepository ( localRepoPath ) ;
205
- DeleteHelper . DeleteGitRepository ( repoBasePath ) ;
206
- }
207
- }
208
-
209
152
[ Test ]
210
153
public void UsingDynamicRepositoryWithFeatureBranchWorks ( )
211
154
{
@@ -218,17 +161,9 @@ public void UsingDynamicRepositoryWithFeatureBranchWorks()
218
161
{
219
162
using ( var mainRepositoryFixture = new EmptyRepositoryFixture ( new Config ( ) ) )
220
163
{
221
- var commitId = mainRepositoryFixture . Repository . MakeACommit ( ) . Id . Sha ;
222
-
223
- var arguments = new Arguments
224
- {
225
- TargetPath = tempDir ,
226
- TargetUrl = mainRepositoryFixture . RepositoryPath ,
227
- TargetBranch = "feature1" ,
228
- CommitId = commitId
229
- } ;
164
+ mainRepositoryFixture . Repository . MakeACommit ( ) ;
230
165
231
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
166
+ var gitPreparer = new GitPreparer ( mainRepositoryFixture . RepositoryPath , null , new Authentication ( ) , "feature1" , false , tempDir ) ;
232
167
gitPreparer . Initialise ( true , null ) ;
233
168
234
169
mainRepositoryFixture . Repository . CreateBranch ( "feature1" ) . Checkout ( ) ;
@@ -254,16 +189,9 @@ public void UsingDynamicRepositoryWithoutTargetBranchFails()
254
189
{
255
190
using ( var mainRepositoryFixture = new EmptyRepositoryFixture ( new Config ( ) ) )
256
191
{
257
- var commitId = mainRepositoryFixture . Repository . MakeACommit ( ) . Id . Sha ;
258
-
259
- var arguments = new Arguments
260
- {
261
- TargetPath = tempDir ,
262
- TargetUrl = mainRepositoryFixture . RepositoryPath ,
263
- CommitId = commitId
264
- } ;
192
+ mainRepositoryFixture . Repository . MakeACommit ( ) ;
265
193
266
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
194
+ var gitPreparer = new GitPreparer ( mainRepositoryFixture . RepositoryPath , null , new Authentication ( ) , null , false , tempDir ) ;
267
195
gitPreparer . Initialise ( true , null ) ;
268
196
269
197
Assert . Throws < Exception > ( ( ) => gitPreparer . Initialise ( true , null ) ) ;
@@ -285,13 +213,7 @@ public void TestErrorThrownForInvalidRepository()
285
213
286
214
try
287
215
{
288
- var arguments = new Arguments
289
- {
290
- TargetPath = tempDir ,
291
- TargetUrl = "http://127.0.0.1/testrepo.git"
292
- } ;
293
-
294
- var gitPreparer = new GitPreparer ( arguments . TargetUrl , arguments . DynamicRepositoryLocation , arguments . Authentication , arguments . TargetBranch , arguments . NoFetch , arguments . TargetPath ) ;
216
+ var gitPreparer = new GitPreparer ( "http://127.0.0.1/testrepo.git" , null , new Authentication ( ) , null , false , tempDir ) ;
295
217
296
218
Assert . Throws < Exception > ( ( ) => gitPreparer . Initialise ( true , null ) ) ;
297
219
}
@@ -300,6 +222,4 @@ public void TestErrorThrownForInvalidRepository()
300
222
Directory . Delete ( tempDir , true ) ;
301
223
}
302
224
}
303
-
304
- // TODO test around normalisation
305
225
}
0 commit comments