Merge "Drop the user provided project name's trailing '.git' suffix"
This commit is contained in:
@@ -46,6 +46,8 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
|||||||
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
||||||
import com.google.gwtjsonrpc.common.VoidResult;
|
import com.google.gwtjsonrpc.common.VoidResult;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.lib.Constants;
|
||||||
|
|
||||||
public class CreateProjectScreen extends Screen {
|
public class CreateProjectScreen extends Screen {
|
||||||
private Grid grid;
|
private Grid grid;
|
||||||
private NpTextBox project;
|
private NpTextBox project;
|
||||||
@@ -235,8 +237,22 @@ public class CreateProjectScreen extends Screen {
|
|||||||
new GerritCallback<VoidResult>() {
|
new GerritCallback<VoidResult>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(VoidResult result) {
|
public void onSuccess(VoidResult result) {
|
||||||
|
String nameWithoutSuffix = projectName;
|
||||||
|
if (nameWithoutSuffix.endsWith(Constants.DOT_GIT_EXT)) {
|
||||||
|
// Be nice and drop the trailing ".git" suffix, which we never
|
||||||
|
// keep in our database, but clients might mistakenly provide
|
||||||
|
// anyway.
|
||||||
|
//
|
||||||
|
nameWithoutSuffix = nameWithoutSuffix.substring(0, //
|
||||||
|
nameWithoutSuffix.length() - Constants.DOT_GIT_EXT.length());
|
||||||
|
while (nameWithoutSuffix.endsWith("/")) {
|
||||||
|
nameWithoutSuffix = nameWithoutSuffix.substring(//
|
||||||
|
0, nameWithoutSuffix.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(
|
History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(
|
||||||
projectName), ProjectScreen.INFO));
|
nameWithoutSuffix), ProjectScreen.INFO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user