Represents a tag in the repository. Tags can reference any IStorableObject in the repository
Inheritance: Ref, IStorableObject
Exemplo n.º 1
0
        public IStorableObject ToGitObject(Repository repo, string sha)
        {
            using (GitObjectReader objectReader = new GitObjectReader(Content))
              {
            IStorableObject obj;
            switch (Type)
            {
              case ObjectType.Commit:
              obj = new Commit(repo, sha);
              break;
            case ObjectType.Tree:
              obj = new Tree(repo, sha);
              break;
            case ObjectType.Blob:
              obj = new Blob(repo, sha);
              break;
            case ObjectType.Tag:
              obj = new Tag(repo, sha);
              break;
            default:
              throw new NotImplementedException();
            }

            obj.Deserialize(objectReader);
            return obj;
              }
        }
Exemplo n.º 2
0
        internal static Tag Load(Repository repo, string sha, string path)
        {
            if (!Utility.IsValidSHA(sha))
            throw new ArgumentException("Tag does not contain valid sha", "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;
              }
        }
Exemplo n.º 3
0
 private void SelectTag(Tag tag)
 {
     if (tag.Object is Commit)
         DisplayCommit(tag.Object as Commit, "Tag "+tag.Name);
 }