Merge branch 'stable-2.12'

* stable-2.12:
  Test that deleting topic returns HTTP status 204
  Let Gerrit read repositories that do not end with ".git'
  Remove obsolete reference from 'delete topic' endpoint documentation

Change-Id: I27ea9fc43a0a5548a5f1a355a10ca72edcda1088
This commit is contained in:
David Pursehouse
2016-07-19 16:11:55 +09:00
3 changed files with 42 additions and 4 deletions

View File

@@ -753,9 +753,6 @@ If the topic was deleted the response is "`204 No Content`".
Deletes the topic of a change.
The request body does not need to include a link:#topic-input[
TopicInput] entity if no review comment is added.
Please note that some proxies prohibit request bodies for DELETE
requests. In this case, if you want to specify a commit message, use
link:#set-topic[PUT] to delete the topic.

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.acceptance.rest.change;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.PushOneCommit.Result;
import org.junit.Test;
public class TopicIT extends AbstractDaemonTest {
@Test
public void topic() throws Exception {
Result result = createChange();
String endpoint = "/changes/" + result.getChangeId() + "/topic";
RestResponse response = adminRestSession.put(endpoint, "topic");
response.assertOK();
response = adminRestSession.delete(endpoint);
response.assertNoContent();
response = adminRestSession.put(endpoint, "topic");
response.assertOK();
response = adminRestSession.put(endpoint, "");
response.assertNoContent();
}
}

View File

@@ -403,7 +403,8 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager,
private boolean isRepo(Path p) {
String name = p.getFileName().toString();
return !name.equals(Constants.DOT_GIT)
&& name.endsWith(Constants.DOT_GIT_EXT);
&& (name.endsWith(Constants.DOT_GIT_EXT)
|| FileKey.isGitRepository(p.toFile(), FS.DETECTED));
}
private void addProject(Path p) {