Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authortherzok <marius.ungureanu@xamarin.com>2019-09-17 21:55:18 +0300
committertherzok <marius.ungureanu@xamarin.com>2019-09-17 21:56:55 +0300
commitd8482dd2e9e30029b151996570294cc403fa5061 (patch)
treecb0df5132784d32b8e15b7eb02f871c47176f8b1 /main
parentf1ea6ad127687763cf4f16064a6d3b143c04316b (diff)
[Git] Remove paths which don't exist from the file lock dictionary
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
index 2e7873b506..77cff9bd29 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
@@ -167,22 +167,23 @@ namespace MonoDevelop.VersionControl.Git
const string cherryPickHead = "CHERRY_PICK_HEAD";
const string revertHead = "REVERT_HEAD";
- static bool ShouldLock (string fullPath)
- {
- var fileName = Path.GetFileName (fullPath);
- return fileName == rebaseApply || fileName == rebaseMerge || fileName == cherryPickHead || fileName == revertHead;
- }
+ static bool ShouldLock (string fileName)
+ => fileName.EndsWith (".lock", FilePath.PathComparison)
+ || fileName == rebaseApply
+ || fileName == rebaseMerge
+ || fileName == cherryPickHead
+ || fileName == revertHead;
void HandleGitLockCreated (object sender, FileSystemEventArgs e)
{
- if (e.FullPath.EndsWith (".lock", StringComparison.Ordinal) || ShouldLock (e.FullPath))
+ if (ShouldLock (e.Name))
OnGitLocked (e.FullPath);
}
void HandleGitLockRenamed (object sender, RenamedEventArgs e)
{
- if (e.OldName.EndsWith (".lock", StringComparison.Ordinal) || ShouldLock (e.OldName)) {
- if (!e.Name.EndsWith (".lock", StringComparison.Ordinal)) {
+ if (ShouldLock (e.OldName)) {
+ if (!ShouldLock (e.Name)) {
OnGitUnlocked (e.OldFullPath);
} else {
lock (lockedPathes) {
@@ -197,7 +198,7 @@ namespace MonoDevelop.VersionControl.Git
void HandleGitLockDeleted (object sender, FileSystemEventArgs e)
{
- if (e.FullPath.EndsWith (".lock", StringComparison.Ordinal) || ShouldLock (e.FullPath))
+ if (ShouldLock (e.Name))
OnGitUnlocked (e.FullPath);
}
@@ -213,7 +214,7 @@ namespace MonoDevelop.VersionControl.Git
void OnGitLocked (string path)
{
lock (lockedPathes) {
- if (lockedPathes.Add (path) && lockedPathes.Count == 1 && gitLock.IsSet) {
+ if (File.Exists (path) && lockedPathes.Add (path) && lockedPathes.Count == 1 && gitLock.IsSet) {
gitLock.Reset ();
FileService.FreezeEvents ();
}
@@ -224,6 +225,8 @@ namespace MonoDevelop.VersionControl.Git
{
lock (lockedPathes) {
lockedPathes.Remove (file);
+ lockedPathes.RemoveWhere (path => !File.Exists (path));
+
if (!gitLock.IsSet && lockedPathes.Count == 0) {
gitLock.Set ();
ThawEvents ();