Include '/a' into HTTP repository URLs to trigger authentication

Not having the '/a' prefix may lead to problems when a part of the
project is visible to Anonymous Users. In this case authentication is
never triggered. This is because for HTTP the first request is always
anonymous and then the server must say that authentication is
required. Only then the client can send user credrentials. If a
project is (partly) visible to Anonymous Users then the first
anonymous request is always successful and authentication never
happens. If the user is not authenticated refs which are not visible
to Anonymous Users, but for which the user has read access, are not
visible. As result the importer plugin cannot fetch these refs and
fails during the import with a NullPointerException when the ref for a
change cannot be found. Often the 'refs/meta/config' branch is
affected since this branch is normally not visible for Anonymous
Users.

With this change Gerrit 2.11.2 is required as minimal version on the
source Gerrit server. The handling of '/a' was fixed by commit
91643418. For earlier Gerrit versions fetching with the '/a' prefix
fails.

Change-Id: I483cffded0dfe3077d4cf95d6002900a9837ff9a
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/BUCK b/BUCK
index 8151afb..e37deb4 100644
--- a/BUCK
+++ b/BUCK
@@ -15,7 +15,7 @@
   manifest_entries = [
     'Gerrit-PluginName: importer',
     'Gerrit-ApiType: plugin',
-    'Gerrit-ApiVersion: 2.11.1',
+    'Gerrit-ApiVersion: 2.11.2',
     'Gerrit-Module: com.googlesource.gerrit.plugins.importer.Module',
     'Gerrit-SshModule: com.googlesource.gerrit.plugins.importer.SshModule',
     'Gerrit-HttpModule: com.googlesource.gerrit.plugins.importer.HttpModule',
diff --git a/VERSION b/VERSION
index 55773d3..9e1a35c 100644
--- a/VERSION
+++ b/VERSION
@@ -1,5 +1,5 @@
 # Used by BUCK to include "Implementation-Version" in plugin Manifest.
 # If this file doesn't exist the output of 'git describe' is used
 # instead.
-PLUGIN_VERSION = '2.11.1'
+PLUGIN_VERSION = '2.11.2'
 
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
index 65d5618..513f901 100644
--- a/lib/gerrit/BUCK
+++ b/lib/gerrit/BUCK
@@ -1,11 +1,12 @@
 include_defs('//bucklets/maven_jar.bucklet')
 
-VER = '2.11.1'
+VER = '2.11.2'
 REPO = MAVEN_CENTRAL
 
 maven_jar(
   name = 'plugin-api',
   id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
+  sha1 = '1d45b5fd8d3f436e34e1a11d3adc07d61717d427',
   attach_source = False,
   repository = REPO,
   license = 'Apache2.0',
@@ -14,6 +15,7 @@
 maven_jar(
   name = 'gwtui-api',
   id = 'com.google.gerrit:gerrit-plugin-gwtui:' + VER,
+  sha1 = 'a2262a4d3d12fe4ea1e67d849d4112f222a1b2b0',
   attach_source = False,
   repository = REPO,
   license = 'Apache2.0',
diff --git a/pom.xml b/pom.xml
index 9dc460a..5d7e185 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
   <groupId>com.googlesource.gerrit.plugins.importer</groupId>
   <artifactId>importer</artifactId>
   <packaging>jar</packaging>
-  <version>2.11.1</version>
+  <version>2.11.2</version>
   <name>importer</name>
 
   <properties>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ConfigureRepositoryStep.java b/src/main/java/com/googlesource/gerrit/plugins/importer/ConfigureRepositoryStep.java
index 8d8b776..7a93521 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ConfigureRepositoryStep.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/ConfigureRepositoryStep.java
@@ -50,7 +50,7 @@
     StoredConfig config = repo.getConfig();
     if (originUrl != null) {
       config.setString("remote", "origin", "url", originUrl
-          .concat("/")
+          .concat("/a/")
           .concat(name.get()));
     } else {
       config.setString("remote", "origin", "url",
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
index bc8061e..c35ca62 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
@@ -96,7 +96,7 @@
   }
 
   private static Logger log = LoggerFactory.getLogger(ImportProject.class);
-  private static Version v2_11 = new Version("2.11");
+  private static Version v2_11_2 = new Version("2.11.2");
 
   private final ProjectCache projectCache;
   private final OpenRepositoryStep openRepoStep;
@@ -212,11 +212,11 @@
     } else {
       input.validateImport();
       Version v = api.getVersion();
-      if (v.compareTo(v2_11) < 0) {
+      if (v.compareTo(v2_11_2) < 0) {
         throw new BadRequestException(String.format(
             "The version of the source Gerrit server %s is too old. "
             + "Its version is %s, but required is a version >= %s.",
-            input.from, v.formatted, v2_11));
+            input.from, v.formatted, v2_11_2));
       }
     }