GitFindRootFromPath will loop forever if a valid Git repository can't be found.
kcamp opened this issue · comments
kcamp commented
If you call GitFindRootFromPath("./")
from a path where no ancestor contains a valid Git repository, the method will loop forever.
Repro
Create a folder where a valid git repository is not accessible - i.e., c:\git\repro
and add this cake script.
#addin "nuget:?package=Cake.Git&version=0.22"
Task("Default")
.Does(() => {
Information("Finding git root");
GitFindRootFromPath(MakeAbsolute(new DirectoryPath(".")));
});
RunTarget("Default");
The task will get caught in the do..while
loop and loop forever.
Cake_Git/src/Cake.Git/GitAliases.Repository.cs
Lines 192 to 201 in 63ee1c9
We need to add a termination condition to the loop and allow the exception to be thrown.
Nils Andresen commented
Closed in #128