improve git repository creation

This commit is contained in:
Sebastian Sdorra
2010-09-29 09:00:44 +02:00
parent f595dec6a5
commit 5bc928b1f6

View File

@@ -86,18 +86,11 @@ public class GitRepositoryHandler
"update-server-info"); "update-server-info");
command.setWorkDirectory(directory); command.setWorkDirectory(directory);
execute(command);
CommandResult result = command.execute(); command = new ExtendedCommand(config.getGitBinary(), "config", "--bool",
"--add", "http.receivepack", "true");
if (!result.isSuccessfull()) command.setWorkDirectory(directory);
{ execute(command);
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 ----------------------------------------------------------
@@ -113,4 +106,31 @@ public class GitRepositoryHandler
{ {
return GitConfig.class; return GitConfig.class;
} }
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param command
*
* @throws IOException
* @throws RepositoryException
*/
private void execute(ExtendedCommand command)
throws IOException, RepositoryException
{
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());
}
}
} }