if ( parts.length >= 1)
{
revision = parts[0];
BlameLine oldLine = commitInfo.get( revision );
if ( oldLine != null )
{
// restore the commit info
author = oldLine.getAuthor();
committer = oldLine.getCommitter();
time = oldLine.getDate();
}
expectRevisionLine = false;
}
}
else
{
if ( line.startsWith( GIT_AUTHOR ) )
{
author = line.substring( GIT_AUTHOR.length() );
return;
}
if ( line.startsWith( GIT_COMMITTER ) )
{
committer = line.substring( GIT_COMMITTER.length() );
return;
}
if ( line.startsWith( GIT_COMMITTER_TIME ) )
{
String timeStr = line.substring( GIT_COMMITTER_TIME.length() );
time = new Date( Long.parseLong( timeStr ) * 1000L );
return;
}
if ( line.startsWith( "\t" ) )
{
// this is the content line.
// we actually don't need the content, but this is the right time to add the blame line
BlameLine blameLine = new BlameLine( time, revision, author, committer );
getLines().add( blameLine );
// keep commitinfo for this sha-1
commitInfo.put( revision, blameLine );