New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-127: Modify do/while in GitFindRootFromPath to avoid infinite loop #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcamp Thanks for fixing this 👍
Code LGTM. Would it be possible for you to also add a test case testing the reported issue?
@pascalberger No problem, got those added. Let me know if there's anything else you'd like. |
Looking into the test failures on the latest push. I think it's going to wind up being environmental on the Travis builds. |
@pascalberger I'm at a bit of a loss for how to address this. In the latest Travis OSX job we get the following:
To me, this seems unexpected (in terms of finding a valid git repository at that path), but I am not familiar with how Travis is configured. The behavior definitely seems to indicate that Does this simply become a matter of scoping this new test to the edit: I changed the scoping of the tests around a bit as a what-if and found that the CI builds are actually running Ideas or advice on how to proceed? Thanks! 👍 |
7401833
to
e88f521
Compare
@kcamp Thanks for your contribution. As far as I can see, the build fails because the fix you implemented does not work on non-windows systems. The main problem seems to be the line I have put up a solution that could be used to solve this at cake-build/cake#3387 (reply in thread) Are you in a position to rebase this PR and implement a more general solution? |
@nils-a Yes, I can rework based on what you've commented. Thanks for the feedback 👍 |
@kcamp sorry for being so rude and implementing the changes myself, but I wanted to get this into the next release. (Which should come soonish...) |
@nils-a looks good to me, just need a rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (context.Environment.Platform.Family == PlatformFamily.Windows) { | ||
// no more parents | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (context.Environment.Platform.Family == PlatformFamily.Windows) { | |
// no more parents | |
return null; | |
} | |
if (context.Environment.Platform.Family == PlatformFamily.Windows) | |
{ | |
// no more parents | |
return null; | |
} |
nitpick / C# brackets police 🛃
and added a workaround for the hitherto missing DirectoryInfo.GetParent()
@kcamp your changes have been merged, thanks for your contribution 👍 |
This change addresses GH-127 to look at the current iteration of
parentDir
and provides a graceful termination consistent with the path simply not existing.Using
System.IO.DirectoryInfo
seemed to be the most straightforward/deterministic approach here; if there's a preferred approach, please feel free to suggest something different.