diff --git a/src/Commands/QueryBranches.cs b/src/Commands/QueryBranches.cs index e598ee08..d8ed808a 100644 --- a/src/Commands/QueryBranches.cs +++ b/src/Commands/QueryBranches.cs @@ -39,7 +39,7 @@ namespace SourceGit.Commands if (refName.StartsWith(PREFIX_DETACHED, StringComparison.Ordinal)) { - branch.IsHead = true; + branch.IsDetachedHead = true; } if (refName.StartsWith(PREFIX_LOCAL, StringComparison.Ordinal)) diff --git a/src/Models/Branch.cs b/src/Models/Branch.cs index f6742d5b..ac6b8c67 100644 --- a/src/Models/Branch.cs +++ b/src/Models/Branch.cs @@ -28,10 +28,10 @@ namespace SourceGit.Models public string Head { get; set; } public bool IsLocal { get; set; } public bool IsCurrent { get; set; } + public bool IsDetachedHead { get; set; } public string Upstream { get; set; } public BranchTrackStatus TrackStatus { get; set; } public string Remote { get; set; } - public bool IsHead { get; set; } public string FriendlyName => IsLocal ? Name : $"{Remote}/{Name}"; } diff --git a/src/ViewModels/BranchTreeNode.cs b/src/ViewModels/BranchTreeNode.cs index 82acb005..33988725 100644 --- a/src/ViewModels/BranchTreeNode.cs +++ b/src/ViewModels/BranchTreeNode.cs @@ -189,7 +189,7 @@ namespace SourceGit.ViewModels { nodes.Sort((l, r) => { - if (l.Backend is Models.Branch { IsHead: true }) + if (l.Backend is Models.Branch { IsDetachedHead: true }) return -1; if (l.Backend is Models.Branch) diff --git a/src/ViewModels/CreateBranch.cs b/src/ViewModels/CreateBranch.cs index 148860b9..e6d2edc1 100644 --- a/src/ViewModels/CreateBranch.cs +++ b/src/ViewModels/CreateBranch.cs @@ -35,7 +35,7 @@ namespace SourceGit.ViewModels public CreateBranch(Repository repo, Models.Branch branch) { _repo = repo; - _baseOnRevision = branch.FullName; + _baseOnRevision = branch.IsDetachedHead ? branch.Head : branch.FullName; if (!branch.IsLocal && repo.Branches.Find(x => x.IsLocal && x.Name == branch.Name) == null) { diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 0bf9645f..5ef34d5b 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -746,7 +746,7 @@ namespace SourceGit.ViewModels } else { - limits += "--branches --remotes --tags"; + limits += "--exclude=refs/stash --all"; } var commits = new Commands.QueryCommits(_fullpath, limits).Result();