mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
improve creation of git repositories
This commit is contained in:
@@ -9,11 +9,13 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.io.CommandResult;
|
||||||
import sonia.scm.io.ExtendedCommand;
|
import sonia.scm.io.ExtendedCommand;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -66,6 +68,38 @@ public class GitRepositoryHandler
|
|||||||
directory.getPath());
|
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 ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -142,6 +142,21 @@ public class Util
|
|||||||
return formatDate(date, null);
|
return formatDate(date, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String nonNull(String value)
|
||||||
|
{
|
||||||
|
return (value != null)
|
||||||
|
? value
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user