improve creation of git repositories

This commit is contained in:
Sebastian Sdorra
2010-09-28 19:02:07 +02:00
parent 12fc507d7b
commit 9bca5a5f07
3 changed files with 50 additions and 1 deletions

View File

@@ -29,7 +29,7 @@
<artifactId>scm-web-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -9,11 +9,13 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.io.CommandResult;
import sonia.scm.io.ExtendedCommand;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
/**
*
@@ -66,6 +68,38 @@ public class GitRepositoryHandler
directory.getPath());
}
/**
* Method description
*
*
* @param repository
* @param directory
*
* @throws IOException
* @throws RepositoryException
*/
@Override
protected void postCreate(Repository repository, File directory)
throws IOException, RepositoryException
{
ExtendedCommand command = new ExtendedCommand(config.getGitBinary(),
"update-server-info");
command.setWorkDirectory(directory);
CommandResult result = command.execute();
if (!result.isSuccessfull())
{
StringBuilder msg = new StringBuilder("command exit with error ");
msg.append(result.getReturnCode()).append(" and message: '");
msg.append(result.getOutput()).append("'");
throw new RepositoryException(msg.toString());
}
}
//~--- get methods ----------------------------------------------------------
/**