Exemple #1
0
        internal ReflogEntry(byte[] raw, int pos)
        {
            oldId = ObjectId.FromString(raw, pos);
            pos  += Constants.OBJECT_ID_STRING_LENGTH;
            if (raw[pos++] != ' ')
            {
                throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
            }
            newId = ObjectId.FromString(raw, pos);
            pos  += Constants.OBJECT_ID_STRING_LENGTH;
            if (raw[pos++] != ' ')
            {
                throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
            }
            who = RawParseUtils.ParsePersonIdentOnly(raw, pos);
            int p0 = RawParseUtils.Next(raw, pos, '\t');

            if (p0 >= raw.Length)
            {
                comment = string.Empty;
            }
            else
            {
                // personident has no \t, no comment present
                int p1 = RawParseUtils.NextLF(raw, p0);
                comment = p1 > p0?RawParseUtils.Decode(raw, p0, p1 - 1) : string.Empty;
            }
        }
Exemple #2
0
            internal Entry(byte[] raw, int pos)
            {
                oldId = ObjectId.FromString(raw, pos);
                pos  += Constants.OBJECT_ID_STRING_LENGTH;
                if (raw[pos++] != ' ')
                {
                    throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
                }
                newId = ObjectId.FromString(raw, pos);
                pos  += Constants.OBJECT_ID_STRING_LENGTH;
                if (raw[pos++] != ' ')
                {
                    throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
                }
                who = RawParseUtils.ParsePersonIdentOnly(raw, pos);
                int p0 = RawParseUtils.Next(raw, pos, '\t');

                // personident has no
                // \t
                if (p0 == -1)
                {
                    throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
                }
                int p1 = RawParseUtils.NextLF(raw, p0);

                if (p1 == -1)
                {
                    throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
                }
                comment = RawParseUtils.Decode(raw, p0, p1 - 1);
            }