feature<Watcher>: sync changes for git-worktrees

This commit is contained in:
leo 2021-06-30 15:09:18 +08:00
parent ee4aa052d2
commit 2ddc61e162
2 changed files with 5 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -22,6 +23,7 @@ namespace SourceGit.Commands {
public override void OnReadline(string line) { public override void OnReadline(string line) {
var match = REG_FORMAT.Match(line); var match = REG_FORMAT.Match(line);
if (!match.Success) return; if (!match.Success) return;
if (line.EndsWith("/", StringComparison.Ordinal)) return; // Ignore changes with git-worktree
var change = new Models.Change() { Path = match.Groups[2].Value }; var change = new Models.Change() { Path = match.Groups[2].Value };
var status = match.Groups[1].Value; var status = match.Groups[1].Value;

View file

@ -177,9 +177,10 @@ namespace SourceGit.Models {
updateStashes = DateTime.Now.AddSeconds(.5).ToFileTime(); updateStashes = DateTime.Now.AddSeconds(.5).ToFileTime();
} else if (e.Name.Equals("HEAD", StringComparison.Ordinal) || } else if (e.Name.Equals("HEAD", StringComparison.Ordinal) ||
e.Name.StartsWith("refs\\heads\\", StringComparison.Ordinal) || e.Name.StartsWith("refs\\heads\\", StringComparison.Ordinal) ||
e.Name.StartsWith("refs\\remotes\\", StringComparison.Ordinal)) { e.Name.StartsWith("refs\\remotes\\", StringComparison.Ordinal) ||
e.Name.StartsWith("worktrees\\")) {
updateBranch = DateTime.Now.AddSeconds(.5).ToFileTime(); updateBranch = DateTime.Now.AddSeconds(.5).ToFileTime();
} else if (e.Name.StartsWith("objects\\") || e.Name.Equals("index", StringComparison.Ordinal)) { } else if (e.Name.StartsWith("objects\\", StringComparison.Ordinal) || e.Name.Equals("index", StringComparison.Ordinal)) {
updateWC = DateTime.Now.AddSeconds(.5).ToFileTime(); updateWC = DateTime.Now.AddSeconds(.5).ToFileTime();
} }
} }