mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix: can not create branch when detached head has extra commits (#344)
This commit is contained in:
parent
ed2d3279e1
commit
e05264e35d
1 changed files with 3 additions and 2 deletions
|
@ -7,7 +7,8 @@ namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
private const string PREFIX_LOCAL = "refs/heads/";
|
private const string PREFIX_LOCAL = "refs/heads/";
|
||||||
private const string PREFIX_REMOTE = "refs/remotes/";
|
private const string PREFIX_REMOTE = "refs/remotes/";
|
||||||
private const string PREFIX_DETACHED = "(HEAD detached at";
|
private const string PREFIX_DETACHED_AT = "(HEAD detached at";
|
||||||
|
private const string PREFIX_DETACHED_FROM = "(HEAD detached from";
|
||||||
|
|
||||||
public QueryBranches(string repo)
|
public QueryBranches(string repo)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,7 @@ namespace SourceGit.Commands
|
||||||
if (refName.EndsWith("/HEAD", StringComparison.Ordinal))
|
if (refName.EndsWith("/HEAD", StringComparison.Ordinal))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (refName.StartsWith(PREFIX_DETACHED, StringComparison.Ordinal))
|
if (refName.StartsWith(PREFIX_DETACHED_AT, StringComparison.Ordinal) || refName.StartsWith(PREFIX_DETACHED_FROM, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
branch.IsDetachedHead = true;
|
branch.IsDetachedHead = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue