Change verboseSuperprojectUpdate config into a tri-state Enum

verboseSuperprojectUpdate was a boolean config option that either do not
include anything (false state) or include the full commit messages(true
state) from all related submodule changes. Add a third state called
SUBJECT_ONLY that only include the subjects of the commits from the
change history. Also set the default to be SUBJECT_ONLY.

Change-Id: I6baa16180c31f36ed3d61930834470c3c27387ed
This commit is contained in:
Zhen Chen
2016-07-27 14:22:37 -07:00
parent 5bc3eef046
commit c877ca9f5e
4 changed files with 80 additions and 9 deletions

View File

@@ -201,6 +201,35 @@ public class SubmoduleSubscriptionsIT extends AbstractSubmoduleSubscription {
"Update git submodules\n\n");
}
@Test
@GerritConfig(name = "submodule.verboseSuperprojectUpdate", value = "SUBJECT_ONLY")
public void testSubmoduleSubjectCommitMessage() throws Exception {
TestRepository<?> superRepo = createProjectWithPush("super-project");
TestRepository<?> subRepo = createProjectWithPush("subscribed-to-project");
allowSubmoduleSubscription("subscribed-to-project", "refs/heads/master",
"super-project", "refs/heads/master");
pushChangeTo(subRepo, "master");
createSubmoduleSubscription(superRepo, "master",
"subscribed-to-project", "master");
ObjectId subHEAD = pushChangeTo(subRepo, "master");
// The first update doesn't include the rev log
RevWalk rw = subRepo.getRevWalk();
expectToHaveCommitMessage(superRepo, "master",
"Update git submodules\n\n" +
"* Update " + name("subscribed-to-project") + " from branch 'master'");
// The next commit should generate only its commit message,
// omitting previous commit logs
subHEAD = pushChangeTo(subRepo, "master");
RevCommit subCommitMsg = rw.parseCommit(subHEAD);
expectToHaveCommitMessage(superRepo, "master",
"Update git submodules\n\n" +
"* Update " + name("subscribed-to-project") + " from branch 'master'"
+ "\n - " + subCommitMsg.getShortMessage());
}
@Test
public void testSubmoduleCommitMessage() throws Exception {
TestRepository<?> superRepo = createProjectWithPush("super-project");