Skip to content

Commit 0c503d3

Browse files
committed
enhance: do not run git command if there's not a file locked by current user
Signed-off-by: leo <longshuang@msn.cn>
1 parent 8d88360 commit 0c503d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ViewModels/LFSLocks.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,18 @@ public async Task UnlockAllMyLocksAsync()
7777
if (_isLoading || string.IsNullOrEmpty(_userName))
7878
return;
7979

80-
IsLoading = true;
81-
8280
var locks = new List<string>();
8381
foreach (var lfsLock in _cachedLocks)
8482
{
8583
if (lfsLock.Owner.Name.Equals(_userName, StringComparison.Ordinal))
8684
locks.Add(lfsLock.Path);
8785
}
8886

87+
if (locks.Count == 0)
88+
return;
89+
90+
IsLoading = true;
91+
8992
var log = _repo.CreateLog("Unlock LFS Locks");
9093
var succ = await new Commands.LFS(_repo.FullPath).Use(log).UnlockMultipleAsync(_remote, locks, true);
9194
if (succ)

0 commit comments

Comments
 (0)