forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorktree.cs
More file actions
39 lines (32 loc) · 1.08 KB
/
Copy pathWorktree.cs
File metadata and controls
39 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.Models
{
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 IsDetached { get; set; } = false;
public bool IsLocked
{
get => _isLocked;
set => SetProperty(ref _isLocked, value);
}
public string Name
{
get
{
if (IsDetached)
return $"detached HEAD at {Head.AsSpan(10)}";
if (Branch.StartsWith("refs/heads/", StringComparison.Ordinal))
return Branch.Substring(11);
if (Branch.StartsWith("refs/remotes/", StringComparison.Ordinal))
return Branch.Substring(13);
return Branch;
}
}
private bool _isLocked = false;
}
}