diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java index dae0a03f22..d2f7e4a3c0 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java @@ -46,6 +46,8 @@ import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwtexpui.globalkey.client.NpTextBox; import com.google.gwtjsonrpc.common.VoidResult; +import org.eclipse.jgit.lib.Constants; + public class CreateProjectScreen extends Screen { private Grid grid; private NpTextBox project; @@ -235,8 +237,22 @@ public class CreateProjectScreen extends Screen { new GerritCallback() { @Override 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( - projectName), ProjectScreen.INFO)); + nameWithoutSuffix), ProjectScreen.INFO)); } @Override