diff --git a/plugins/scm-git-plugin/pom.xml b/plugins/scm-git-plugin/pom.xml index 70c5c62706..03059db1bd 100644 --- a/plugins/scm-git-plugin/pom.xml +++ b/plugins/scm-git-plugin/pom.xml @@ -29,7 +29,7 @@ scm-web-api 1.0-SNAPSHOT - + diff --git a/plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitRepositoryHandler.java b/plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitRepositoryHandler.java index 8af06fa74f..232734b509 100644 --- a/plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitRepositoryHandler.java +++ b/plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitRepositoryHandler.java @@ -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 ---------------------------------------------------------- /** diff --git a/scm-core/src/main/java/sonia/scm/util/Util.java b/scm-core/src/main/java/sonia/scm/util/Util.java index a485d29458..d756c05267 100644 --- a/scm-core/src/main/java/sonia/scm/util/Util.java +++ b/scm-core/src/main/java/sonia/scm/util/Util.java @@ -142,6 +142,21 @@ public class Util return formatDate(date, null); } + /** + * Method description + * + * + * @param value + * + * @return + */ + public static String nonNull(String value) + { + return (value != null) + ? value + : ""; + } + /** * Method description *