Exemplo n.º 1
0
        public TagData ParseTag(QueryTagParameters parameters, GitOutput output)
        {
            Assert.IsNotNull(parameters);
            Assert.IsNotNull(output);

            var tag = output.Output;
            if(output.ExitCode == 0 && tag.Length >= 40)
            {
                Hash hash;
                TagType type;
                if(tag.Length >= 81)
                {
                    hash = new Hash(output.Output, 41);
                    type = TagType.Annotated;
                }
                else
                {
                    hash = new Hash(output.Output);
                    type = TagType.Lightweight;
                }
                return new TagData(parameters.TagName, hash, type);
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 2
0
        public Command GetQueryTagCommand(QueryTagParameters parameters)
        {
            Assert.IsNotNull(parameters);

            string fullTagName = GitConstants.TagPrefix + parameters.TagName;
            return new ShowRefCommand(
                ShowRefCommand.Tags(),
                ShowRefCommand.Dereference(),
                ShowRefCommand.Hash(),
                ShowRefCommand.NoMoreOptions(),
                new CommandParameter(fullTagName));
        }