mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
improve creation of git repositories
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<artifactId>scm-web-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user