mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
code_style: rewrite Commands.QueryTags.ParseLine
This commit is contained in:
parent
5bad969bb7
commit
b6468e310b
1 changed files with 7 additions and 18 deletions
|
@ -32,25 +32,14 @@ namespace SourceGit.Commands
|
|||
|
||||
private Models.Tag ParseLine(string line)
|
||||
{
|
||||
var subs = line.Split('\0', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (subs.Length == 2)
|
||||
{
|
||||
return new Models.Tag()
|
||||
{
|
||||
Name = subs[0].Substring(10),
|
||||
SHA = subs[1],
|
||||
};
|
||||
}
|
||||
else if (subs.Length == 3)
|
||||
{
|
||||
return new Models.Tag()
|
||||
{
|
||||
Name = subs[0].Substring(10),
|
||||
SHA = subs[2],
|
||||
};
|
||||
}
|
||||
var subs = line.Split('\0');
|
||||
if (subs.Length != 3)
|
||||
return null;
|
||||
|
||||
return null;
|
||||
var tag = new Models.Tag();
|
||||
tag.Name = subs[0].Substring(10);
|
||||
tag.SHA = string.IsNullOrEmpty(subs[2]) ? subs[1] : subs[2];
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue