diff --git a/src/GitVersionCore/Extensions/ArgumentExtensions.cs b/src/GitVersionCore/Extensions/ArgumentExtensions.cs index 9be1860983..16e3b247a0 100644 --- a/src/GitVersionCore/Extensions/ArgumentExtensions.cs +++ b/src/GitVersionCore/Extensions/ArgumentExtensions.cs @@ -26,12 +26,7 @@ public static string GetDotGitDirectory(this Arguments arguments) public static string GetProjectRootDirectory(this Arguments arguments) { - if (arguments.IsDynamicGitRepository()) - { - return arguments.GetWorkingDirectory(); - } - - var dotGitDirectory = Repository.Discover(arguments.GetWorkingDirectory()); + var dotGitDirectory = Repository.Discover(arguments.IsDynamicGitRepository() ? arguments.DynamicGitRepositoryPath : arguments.GetWorkingDirectory()); if (string.IsNullOrEmpty(dotGitDirectory)) throw new DirectoryNotFoundException($"Can't find the .git directory in {dotGitDirectory}"); diff --git a/src/GitVersionCore/GitVersionCalculator.cs b/src/GitVersionCore/GitVersionCalculator.cs index 511fe3369d..8ccee859f3 100644 --- a/src/GitVersionCore/GitVersionCalculator.cs +++ b/src/GitVersionCore/GitVersionCalculator.cs @@ -61,7 +61,7 @@ private VersionVariables ExecuteInternal(Arguments arguments) { var configuration = configProvider.Provide(overrideConfig: arguments.OverrideConfig); - using var repo = new Repository(arguments.GetDotGitDirectory()); + using var repo = new Repository(arguments.GetProjectRootDirectory()); var targetBranch = repo.GetTargetBranch(arguments.TargetBranch); var gitVersionContext = new GitVersionContext(repo, log, targetBranch, configuration, commitId: arguments.CommitId); var semanticVersion = nextVersionCalculator.FindVersion(gitVersionContext);