GitSharp.Core.Repository.UpdateRef C# (CSharp) Method

UpdateRef() public method

Create a command to update (or create) a ref in this repository.
public UpdateRef ( string refName ) : RefUpdate
refName string /// name of the ref the caller wants to modify. ///
return RefUpdate
        public RefUpdate UpdateRef(string refName)
        {
            return _refDb.NewUpdate(refName);
        }

Same methods

Repository::UpdateRef ( string refName, bool detach ) : RefUpdate

Usage Example

Example #1
0
        /**
         * Store a tag.
         * If author, message or type is set make the tag an annotated tag.
         *
         * @
         */
        public void Save()  //renamed from Tag
        {
            if (TagId != null)
            {
                throw new InvalidOperationException("exists " + TagId);
            }
            ObjectId id;

            if (author != null || message != null || tagType != null)
            {
                ObjectId tagid = new ObjectWriter(Repository).WriteTag(this);
                TagId = tagid;
                id    = tagid;
            }
            else
            {
                id = Id;
            }

            RefUpdate ru = Repository.UpdateRef(Constants.RefsTags + TagName);

            ru.NewObjectId = id;
            ru.SetRefLogMessage("tagged " + TagName, false);
            if (ru.ForceUpdate() == RefUpdate.RefUpdateResult.LockFailure)
            {
                throw new ObjectWritingException("Unable to lock tag " + TagName);
            }
        }
All Usage Examples Of GitSharp.Core.Repository::UpdateRef