-
Notifications
You must be signed in to change notification settings - Fork 652
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
Use .git directory for mutex name #2676
Conversation
I see one test has failed on ubuntu, but there's no real information to go on to understand why it might have failed. That same test seems to have passed on Windows and mac. Any chance that test is flaky and just needs another run? I'm thinking it might be since it looks like it did pass on the Azure run. |
@@ -57,7 +57,7 @@ public int Execute(GitVersionOptions gitVersionOptions) | |||
|
|||
private int RunGitVersionTool(GitVersionOptions gitVersionOptions) | |||
{ | |||
var mutexName = gitVersionOptions.WorkingDirectory.Replace(Path.DirectorySeparatorChar.ToString(), ""); | |||
var mutexName = repositoryInfo.DotGitDirectory.Replace(Path.DirectorySeparatorChar.ToString(), ""); |
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.
Perhaps prefixing gitversion
to the mutex to avoid anyone else using the same mutex?
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.
It seems a bit unlikely that another mutex with the exact name of the path of the .git folder would exist, but it probably wouldn't hurt to be a bit more defensive.
Looking at the mutex documentation, there is some vague stuff about potential maximum lengths of mutex names, but there are no actual values given, so I guess we'll have to see if there are any bug reports about names being too long and determine what do to if that happens.
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.
The maximum length of mutex names is MAX_PATH
, which is defined as 260 characters. So you should be fine here. (Source: CreateMutexW documentation)
Please note that mutex names are case sensitive. Should be ok as long as repositoryInfo.DotGitDirectoryrepositoryInfo.DotGitDirectory
has always the same casing.
@arturcic Looks like that test failed again, this time on Windows. Is this a known flaky test, or is this something I need to be trying to figure out if the PR is causing it? |
That error seems to have been with us for some time, IIRC. I think it's a bug in Cake or at least in how we are using Cake, somehow. See cake-build/cake#3164 for details. |
Thank you @bording for your contribution! |
🎉 This issue has been resolved in version 5.6.10 🎉 Your GitReleaseManager bot 📦🚀 |
Follow-up PR to #2669 to fix the mutex name. Based on the command line documentation and my initial investigation of the code, I thought
WorkingDirectory
would be the actual git working directory, but that turns out to not be true.Instead, I've switched to using
IGitRepositoryInfo.DotGitDirectory
, which should always be pointing at the same location for all projects in a solution.If there are projects that have different
DotGitDirectory
values in a solution, then that would mean they are operating on completely different repos, but that likely means you have something misconfigured in your solution anyway.Related Issue
#2669
Checklist: