/** {@inheritDoc} */
protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
ScmVersion startVersion, ScmVersion endVersion )
throws ScmException
{
GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), fileSet.getBasedir() );
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
Commandline clDiff2Index = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, false );
exitCode = GitCommandLineUtils.execute( clDiff2Index, consumer, stderr, getLogger() );
if ( exitCode != 0 )
{
return new DiffScmResult( clDiff2Index.toString(), "The git-diff command failed.", stderr.getOutput(),
false );
}
Commandline clDiff2Head = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, true );
exitCode = GitCommandLineUtils.execute( clDiff2Head, consumer, stderr, getLogger() );
if ( exitCode != 0 )
{
return new DiffScmResult( clDiff2Head.toString(), "The git-diff command failed.", stderr.getOutput(), false );
}
return new DiffScmResult( clDiff2Index.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
consumer.getPatch() );
}