feat: Add GitRepoRegistration cmdlets #5

Merged
pascal_nulah merged 69 commits from feature/git-provider into dev 2026-09-06 09:33:36 +10:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 1363f6ce02 - Show all commits

chore(git-provider): explore setting the location based on a child fragment match

Scott 2026-08-07 16:49:30 +10:00

View file

@ -61,6 +61,24 @@ public class GitProvider : NavigationCmdletProvider
return true;
}
protected override string MakePath(string parent, string child)
{
// Test to see what happens if set the location if the path matches a pretend repo registered with the name test
// The result of the test is that yes, this does work, but there's also a shit load of calls to this method as
// it traverses the entire directory path.
// This seems to just be internal powershell behaviour so as long as this is quick the first time, everything
// afterwards just always happens. But probably happens more seeing as I'm changing the location of the path
// in this current SessionState and probably doesn't happen if this were a normal path traversal
// where I don't set the location.
if (child == "test")
{
SessionState.Path.SetLocation("F:/Repos/PowershellModule/src/PowershellModule/Git");
return "F:/Repos/PowershellModule/src/PowershellModule/Git";
}
return base.MakePath(parent, child);
}
protected override bool IsValidPath(string path)
{
throw new System.NotImplementedException();

View file

@ -33,7 +33,6 @@ public class NewGitRepoCommand : PSCmdlet
var repoFolfder = IsGitRepo(pwd);
base.BeginProcessing();
}
@ -114,6 +113,7 @@ public class SetGitRepoCommand : PSCmdlet
protected override void BeginProcessing()
{
SessionState.Path.SetLocation("F:/Repos/PowershellModule/src/PowershellModule/Git");
base.BeginProcessing();
}
}