diff --git a/src/ModuleCore/Git/GitManager.cs b/src/ModuleCore/Git/GitManager.cs
index eeb3b60..f301244 100644
--- a/src/ModuleCore/Git/GitManager.cs
+++ b/src/ModuleCore/Git/GitManager.cs
@@ -108,6 +108,7 @@ public class GitManager
if (_registrations.TryAdd(registrationName, gitRegistration))
{
+ _debugWriterDelegate?.Invoke($"Registered '{gitRegistration.Location}' to name '{registrationName}'");
return registrationName;
}
@@ -196,6 +197,9 @@ public class GitManager
///
/// Returns the git root directory for any nested directory if git rev-parse --show-toplevel returns a value.
+ ///
+ /// Will always return a non-null value if the directory is a git repo, otherwise an exception will be thrown
+ ///
///
/// Path to check if it or any of its parents contain a git repository
///
@@ -236,7 +240,7 @@ public class GitManager
// Gotta trim what we get as it might already have a newline character at the end
var dirInfo = new DirectoryInfo(directory.Trim());
- _debugWriterDelegate?.Invoke("...location is a git repo (duh).");
+ _debugWriterDelegate?.Invoke("...location is a git repo!");
var repoFolderInfo = new ParsedGitFolderDetails
{
diff --git a/src/PowershellModule/Git/Commands/NewGitRepoRegistrationCommand.cs b/src/PowershellModule/Git/Commands/NewGitRepoRegistrationCommand.cs
index 1f968aa..ec460eb 100644
--- a/src/PowershellModule/Git/Commands/NewGitRepoRegistrationCommand.cs
+++ b/src/PowershellModule/Git/Commands/NewGitRepoRegistrationCommand.cs
@@ -19,8 +19,15 @@ public sealed class NewGitRepoRegistrationCommand : PSCmdlet
{
GitManager.SetDebugWriter(WriteDebug);
+ // Test that we're in a git repo first. If we aren't (or git isn't available), this method will throw
+ // so we don't need to handle for null (yet).
var repoFolder = GitManager.IsGitRepo(SessionState.Path.CurrentLocation.Path);
+ if (string.IsNullOrWhiteSpace(Name))
+ {
+ WriteDebug("No name given for registration, defaulting to git folder root.");
+ }
+
GitManager.Instance.RegisterRepo(repoFolder.Directory, Name ?? repoFolder.Folder);
GitManager.ClearDebugWriter();