fix: %(refname:short) sometimes return a wrong tag name that contains the prefix tags/

This commit is contained in:
leo 2024-07-24 18:52:12 +08:00
parent 869ba7a471
commit 8e60ec619e
No known key found for this signature in database

View file

@ -9,7 +9,7 @@ namespace SourceGit.Commands
{ {
Context = repo; Context = repo;
WorkingDirectory = repo; WorkingDirectory = repo;
Args = "for-each-ref --sort=-creatordate --format=\"$%(refname:short)$%(objectname)$%(*objectname)\" refs/tags"; Args = "tag -l --sort=-creatordate --format=\"$%(refname)$%(objectname)$%(*objectname)\"";
} }
public List<Models.Tag> Result() public List<Models.Tag> Result()
@ -25,7 +25,7 @@ namespace SourceGit.Commands
{ {
_loaded.Add(new Models.Tag() _loaded.Add(new Models.Tag()
{ {
Name = subs[0], Name = subs[0].Substring(10),
SHA = subs[1], SHA = subs[1],
}); });
} }
@ -33,7 +33,7 @@ namespace SourceGit.Commands
{ {
_loaded.Add(new Models.Tag() _loaded.Add(new Models.Tag()
{ {
Name = subs[0], Name = subs[0].Substring(10),
SHA = subs[2], SHA = subs[2],
}); });
} }