internal static Tag Load(Repository repo, string sha, string path)
{
if (!Utility.IsValidSHA(sha))
throw new ParseException("Tag does not contain valid sha");
IStorableObject obj = repo.Storage.GetObject(sha);
// This is kind of flaky but for now the only way we can distinguish a regular and a lightweight tag
if (obj is Tag)
{
((Tag)obj).Path = path;
return (Tag)obj;
}
else
{
Tag t = new Tag(repo, sha);
t.Object = obj;
t.Path = path;
return t;
}
}