-
Notifications
You must be signed in to change notification settings - Fork 63
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
Scalar.Service: unregister repo when it's not on disk #206
Conversation
Scalar.Service/RepoRegistry.cs
Outdated
// Unregister the repo, but only after confirming that its volume still | ||
// exists (or is empty/whitespace). If the volume does not exist we'll | ||
// assume the drive was removed or is encrypted, and we'll leave the repo | ||
// in the registry (but we won't run maintenance on it). |
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.
Note: This check is very Windows specific. I suspect that on Mac this.fileSystem.DirectoryExists(rootPath)
will always succeed because the root will always be /
.
If we find that people frequently clone to removable drives (that are frequently removed) we might need to make this check smarter or the service will unregister the repos that live on the (detached) removable drive.
cc: @jrbriggs @derrickstolee as FYI
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.
That makes sense.
Could you reorganize the heavily-nested if
statements here?
if (volume does not exist) {
log;
continue;
}
if (directory does not exist) {
try remove;
log result;
continue;
}
run maintenance;
Filed #207 for an issue I found with That issue is unrelated to the changes in this PR. |
7bbf441
to
b21d8f1
Compare
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.
Approved with suggestion.
Update the RepoRegistry to check if the enlistment root exists on disk before attempting to run the maintenance verb against it. If the enlistment root does not exist on disk, but it's root directory *does* exist, then also remove the repo from the registry. Checking that the root of the enlistment path exists before removing the repo from the registry ensures that we will not remove repos that are temporarily unavailable (e.g. due to Bitlocker or a removable drive not being present). See the discussion in microsoft/VFSForGit#359 for details.
c41ea8f
to
920a1b0
Compare
Part of the work required for #111
Update the RepoRegistry to check if the enlistment root
exists on disk before attempting to run the maintenance
verb against it. If the enlistment root does not exist
on disk, but it's root directory does exist, then
also remove the repo from the registry.
Checking that the root of the enlistment path exists
before removing the repo from the registry ensures that
we will not remove repos that are temporarily unavailable
(e.g. due to Bitlocker or a removable drive not being
present). See the discussion in
microsoft/VFSForGit#359 for details.