@@ -48,7 +48,10 @@ public void Initialise(bool normaliseGitDirectory, string currentBranch)
48
48
{
49
49
if ( normaliseGitDirectory )
50
50
{
51
- GitRepositoryHelper . NormalizeGitDirectory ( GetDotGitDirectory ( ) , authentication , noFetch , currentBranch ) ;
51
+ using ( Logger . IndentLog ( string . Format ( "Normalizing git directory for branch '{0}'" , currentBranch ) ) )
52
+ {
53
+ GitRepositoryHelper . NormalizeGitDirectory ( GetDotGitDirectory ( ) , authentication , noFetch , currentBranch ) ;
54
+ }
52
55
}
53
56
return ;
54
57
}
@@ -144,23 +147,31 @@ static string CreateDynamicRepository(string targetPath, AuthenticationInfo auth
144
147
{
145
148
throw new Exception ( "Dynamic Git repositories must have a target branch (/b)" ) ;
146
149
}
147
- Logger . WriteInfo ( string . Format ( "Creating dynamic repository at '{0}'" , targetPath ) ) ;
148
150
149
- var gitDirectory = Path . Combine ( targetPath , ".git" ) ;
150
- if ( Directory . Exists ( targetPath ) )
151
+ using ( Logger . IndentLog ( string . Format ( "Creating dynamic repository at '{0}'" , targetPath ) ) )
151
152
{
152
- Logger . WriteInfo ( "Git repository already exists" ) ;
153
- GitRepositoryHelper . NormalizeGitDirectory ( gitDirectory , authentication , noFetch , targetBranch ) ;
153
+ var gitDirectory = Path . Combine ( targetPath , ".git" ) ;
154
+ if ( Directory . Exists ( targetPath ) )
155
+ {
156
+ Logger . WriteInfo ( "Git repository already exists" ) ;
157
+ using ( Logger . IndentLog ( string . Format ( "Normalizing git directory for branch '{0}'" , targetBranch ) ) )
158
+ {
159
+ GitRepositoryHelper . NormalizeGitDirectory ( gitDirectory , authentication , noFetch , targetBranch ) ;
160
+ }
154
161
155
- return gitDirectory ;
156
- }
162
+ return gitDirectory ;
163
+ }
157
164
158
- CloneRepository ( repositoryUrl , gitDirectory , authentication ) ;
165
+ CloneRepository ( repositoryUrl , gitDirectory , authentication ) ;
159
166
160
- // Normalize (download branches) before using the branch
161
- GitRepositoryHelper . NormalizeGitDirectory ( gitDirectory , authentication , noFetch , targetBranch ) ;
167
+ using ( Logger . IndentLog ( string . Format ( "Normalizing git directory for branch '{0}'" , targetBranch ) ) )
168
+ {
169
+ // Normalize (download branches) before using the branch
170
+ GitRepositoryHelper . NormalizeGitDirectory ( gitDirectory , authentication , noFetch , targetBranch ) ;
171
+ }
162
172
163
- return gitDirectory ;
173
+ return gitDirectory ;
174
+ }
164
175
}
165
176
166
177
static void CloneRepository ( string repositoryUrl , string gitDirectory , AuthenticationInfo authentication )
@@ -177,17 +188,20 @@ static void CloneRepository(string repositoryUrl, string gitDirectory, Authentic
177
188
} ;
178
189
}
179
190
180
- Logger . WriteInfo ( string . Format ( "Retrieving git info from url '{0}'" , repositoryUrl ) ) ;
181
191
182
192
try
183
193
{
184
- var cloneOptions = new CloneOptions
194
+ using ( Logger . IndentLog ( string . Format ( "Cloning repository from url '{0}'" , repositoryUrl ) ) )
185
195
{
186
- Checkout = false ,
187
- CredentialsProvider = ( url , usernameFromUrl , types ) => credentials
188
- } ;
189
- var returnedPath = Repository . Clone ( repositoryUrl , gitDirectory , cloneOptions ) ;
190
- Logger . WriteInfo ( string . Format ( "Returned path after repository clone: {0}" , returnedPath ) ) ;
196
+ var cloneOptions = new CloneOptions
197
+ {
198
+ Checkout = false ,
199
+ CredentialsProvider = ( url , usernameFromUrl , types ) => credentials
200
+ } ;
201
+
202
+ var returnedPath = Repository . Clone ( repositoryUrl , gitDirectory , cloneOptions ) ;
203
+ Logger . WriteInfo ( string . Format ( "Returned path after repository clone: {0}" , returnedPath ) ) ;
204
+ }
191
205
}
192
206
catch ( LibGit2SharpException ex )
193
207
{
0 commit comments