diff --git a/src/Commands/Worktree.cs b/src/Commands/Worktree.cs index 27c0e28ee..b73b85732 100644 --- a/src/Commands/Worktree.cs +++ b/src/Commands/Worktree.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; namespace SourceGit.Commands { @@ -26,6 +27,7 @@ public Worktree(string repo) if (line.StartsWith("worktree ", StringComparison.Ordinal)) { last = new Models.Worktree() { FullPath = line.Substring(9).Trim() }; + last.RelativePath = Path.GetRelativePath(WorkingDirectory, last.FullPath); worktrees.Add(last); } else if (line.StartsWith("bare", StringComparison.Ordinal)) diff --git a/src/Models/Worktree.cs b/src/Models/Worktree.cs index f9ba14e4a..bc40e320f 100644 --- a/src/Models/Worktree.cs +++ b/src/Models/Worktree.cs @@ -6,6 +6,7 @@ public class Worktree : ObservableObject { public string Branch { get; set; } = string.Empty; public string FullPath { get; set; } = string.Empty; + public string RelativePath { get; set; } = string.Empty; public string Head { get; set; } = string.Empty; public bool IsBare { get; set; } = false; public bool IsDetached { get; set; } = false; @@ -21,15 +22,15 @@ public string Name get { if (IsDetached) - return $"(deteched HEAD at {Head.Substring(10)})"; + return $"deteched HEAD at {Head.Substring(10)}"; if (Branch.StartsWith("refs/heads/", System.StringComparison.Ordinal)) - return $"({Branch.Substring(11)})"; + return Branch.Substring(11); if (Branch.StartsWith("refs/remotes/", System.StringComparison.Ordinal)) - return $"({Branch.Substring(13)})"; + return Branch.Substring(13); - return $"({Branch})"; + return Branch; } } diff --git a/src/Views/RemoveWorktree.axaml b/src/Views/RemoveWorktree.axaml index 6d7ea914d..364881d2b 100644 --- a/src/Views/RemoveWorktree.axaml +++ b/src/Views/RemoveWorktree.axaml @@ -18,8 +18,8 @@ - - + + () diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 74f628c61..4180a0546 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -372,8 +372,8 @@ - - + + ()