コード例 #1
0
ファイル: RevCommit.cs プロジェクト: kkl713/GitSharp
        ///	<summary>
        /// Parse the author identity from the raw buffer.
        /// <para />
        /// This method parses and returns the content of the author line, after
        /// taking the commit's character set into account and decoding the author
        /// name and email address. This method is fairly expensive and produces a
        /// new PersonIdent instance on each invocation. Callers should invoke this
        /// method only if they are certain they will be outputting the result, and
        /// should cache the return value for as long as necessary to use all
        /// information from it.
        /// <para />
        /// <see cref="RevFilter"/> implementations should try to use <seealso cref="RawParseUtils"/> to scan
        /// the <seealso cref="RawBuffer"/> instead, as this will allow faster evaluation
        /// of commits.
        /// </summary>
        /// <returns>
        /// Identity of the author (name, email) and the time the commit was
        /// made by the author; null if no author line was found.
        /// </returns>
        public PersonIdent getAuthorIdent()
        {
            byte[] raw   = _buffer;
            int    nameB = RawParseUtils.author(raw, 0);

            if (nameB < 0)
            {
                return(null);
            }
            return(RawParseUtils.parsePersonIdent(raw, nameB));
        }
コード例 #2
0
        private static string TextFor(RevCommit cmit)
        {
            byte[] raw = cmit.RawBuffer;
            int    b   = RawParseUtils.author(raw, 0);

            if (b < 0)
            {
                return(string.Empty);
            }
            int e = RawParseUtils.nextLF(raw, b, (byte)'>');

            return(Constants.CHARSET.GetString(raw, b, e));
        }