mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
enhance: create branch on detached HEAD (#344)
This commit is contained in:
parent
c596427380
commit
ed2d3279e1
5 changed files with 5 additions and 5 deletions
|
@ -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))
|
||||
|
|
|
@ -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}";
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue