From 5ee1030791befaa4d55830e60b4eccddac689b37 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 26 Jun 2017 12:15:16 +0300 Subject: [PATCH] Gerrit: Workaround gerrit issue when origin has /p prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /p was used with older versions of gerrit. It is no longer required, but still supported. Change-Id: Ie7c6a941031c56cf805c13518deec0fadb2f69ab Reviewed-by: André Hartmann --- src/plugins/git/gerrit/gerritserver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/git/gerrit/gerritserver.cpp b/src/plugins/git/gerrit/gerritserver.cpp index 2a0303015e7..6abb17585dc 100644 --- a/src/plugins/git/gerrit/gerritserver.cpp +++ b/src/plugins/git/gerrit/gerritserver.cpp @@ -236,6 +236,10 @@ int GerritServer::testConnection() Core::ShellCommand::NoOutput); if (resp.result == SynchronousProcessResponse::Finished) { QString output = resp.stdOut(); + // Gerrit returns an empty response for /p/qt-creator/a/accounts/self + // so consider this as 404. + if (output.isEmpty()) + return PageNotFound; output.remove(0, output.indexOf('\n')); // Strip first line QJsonDocument doc = QJsonDocument::fromJson(output.toUtf8()); if (!doc.isNull()) {