File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/NerdBank.GitVersioning Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ private static LibGit2Sharp.Repository OpenGitRepo(string repoRoot)
265265 {
266266 Requires . NotNullOrEmpty ( repoRoot , nameof ( repoRoot ) ) ;
267267 var gitDir = FindGitDir ( repoRoot ) ;
268- return gitDir == null ? null : new LibGit2Sharp . Repository ( gitDir ) ;
268+ return gitDir == null ? null : new LibGit2Sharp . Repository ( gitDir ) ;
269269 }
270270
271271 private static string FindGitDir ( string startingDir )
@@ -274,20 +274,25 @@ private static string FindGitDir(string startingDir)
274274 {
275275 var dirOrFilePath = Path . Combine ( startingDir , ".git" ) ;
276276 if ( Directory . Exists ( dirOrFilePath ) )
277+ {
277278 return dirOrFilePath ;
279+ }
278280 else if ( File . Exists ( dirOrFilePath ) )
279281 {
280282 var relativeGitDirPath = ReadGitDirFromFile ( dirOrFilePath ) ;
281283 if ( ! String . IsNullOrWhiteSpace ( relativeGitDirPath ) )
282284 {
283285 var fullGitDirPath = Path . GetFullPath ( Path . Combine ( startingDir , relativeGitDirPath ) ) ;
284286 if ( Directory . Exists ( fullGitDirPath ) )
287+ {
285288 return fullGitDirPath ;
289+ }
286290 }
287291 }
288-
292+
289293 startingDir = Path . GetDirectoryName ( startingDir ) ;
290294 }
295+
291296 return null ;
292297 }
293298
@@ -304,7 +309,6 @@ private static string ReadGitDirFromFile(string fileName)
304309 }
305310 }
306311
307-
308312 private static Version GetAssemblyVersion ( Version version , VersionOptions versionOptions )
309313 {
310314 // If there is no repo, "version" could have uninitialized components (-1).
You can’t perform that action at this time.
0 commit comments