示例#1
0
        private static RefState TryResolveReference(out Reference reference, ReferenceCollection refsColl, string canonicalName)
        {
            if (!Reference.IsValidName(canonicalName))
            {
                reference = null;
                return(RefState.DoesNotLookValid);
            }

            reference = refsColl[canonicalName];

            return(reference != null ? RefState.Exists : RefState.DoesNotExistButLooksValid);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReflogCollection"/> class.
        /// </summary>
        /// <param name="repo">The repo.</param>
        /// <param name="canonicalName">the canonical name of the <see cref="Reference"/> to retrieve reflog entries on.</param>
        internal ReflogCollection(Repository repo, string canonicalName)
        {
            Ensure.ArgumentNotNullOrEmptyString(canonicalName, "canonicalName");
            Ensure.ArgumentNotNull(repo, "repo");

            if (!Reference.IsValidName(canonicalName))
            {
                throw new InvalidSpecificationException("The given reference name '{0}' is not valid", canonicalName);
            }

            this.repo          = repo;
            this.canonicalName = canonicalName;
        }