SubmoduleOp: Fix formatting of submodule update commit message
When multiple submodules are updated, the commit message does not include newlines between the list of updated submodules. Add newlines, and update the test to include an assertion on the commit message. Bug: Issue 4889 Change-Id: I0756a87034a0b2b432a8339596147d765aa8cd4d
This commit is contained in:
parent
b5f32d09d9
commit
a6cadb97de
|
@ -308,6 +308,52 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
|
|||
expectToHaveSubmoduleState(superRepo, "master", "sub2", sub2, "master");
|
||||
expectToHaveSubmoduleState(superRepo, "master", "sub3", sub3, "master");
|
||||
|
||||
String sub1HEAD =
|
||||
sub1.git()
|
||||
.fetch()
|
||||
.setRemote("origin")
|
||||
.call()
|
||||
.getAdvertisedRef("refs/heads/master")
|
||||
.getObjectId()
|
||||
.name();
|
||||
|
||||
String sub2HEAD =
|
||||
sub2.git()
|
||||
.fetch()
|
||||
.setRemote("origin")
|
||||
.call()
|
||||
.getAdvertisedRef("refs/heads/master")
|
||||
.getObjectId()
|
||||
.name();
|
||||
|
||||
String sub3HEAD =
|
||||
sub3.git()
|
||||
.fetch()
|
||||
.setRemote("origin")
|
||||
.call()
|
||||
.getAdvertisedRef("refs/heads/master")
|
||||
.getObjectId()
|
||||
.name();
|
||||
|
||||
if (getSubmitType() == SubmitType.MERGE_IF_NECESSARY) {
|
||||
expectToHaveCommitMessage(
|
||||
superRepo,
|
||||
"master",
|
||||
"Update git submodules\n\n"
|
||||
+ "* Update "
|
||||
+ name("sub3")
|
||||
+ " from branch 'master'\n to "
|
||||
+ sub3HEAD
|
||||
+ "\n\n* Update "
|
||||
+ name("sub2")
|
||||
+ " from branch 'master'\n to "
|
||||
+ sub2HEAD
|
||||
+ "\n\n* Update "
|
||||
+ name("sub1")
|
||||
+ " from branch 'master'\n to "
|
||||
+ sub1HEAD);
|
||||
}
|
||||
|
||||
superRepo
|
||||
.git()
|
||||
.fetch()
|
||||
|
|
|
@ -375,8 +375,13 @@ public class SubmoduleOp {
|
|||
PersonIdent author = null;
|
||||
DirCache dc = readTree(or.rw, currentCommit);
|
||||
DirCacheEditor ed = dc.editor();
|
||||
int count = 0;
|
||||
for (SubmoduleSubscription s : targets.get(subscriber)) {
|
||||
if (count > 0) {
|
||||
msgbuf.append("\n\n");
|
||||
}
|
||||
RevCommit newCommit = updateSubmodule(dc, ed, msgbuf, s);
|
||||
count++;
|
||||
if (newCommit != null) {
|
||||
if (author == null) {
|
||||
author = newCommit.getAuthorIdent();
|
||||
|
|
Loading…
Reference in New Issue