Skip to content
Permalink
Browse files
vcs: don't append newlines to tag messages
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Aug 24, 2020
1 parent b15e755 commit 6c52d67a0f0b988c58cb157df7b1bb2c22cee414
@@ -1450,7 +1450,7 @@ public Optional<Tag.Annotated> annotate(Tag tag) throws IOException {
var author = Author.fromString(authorLine);
var formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
var date = ZonedDateTime.parse(dateLine, formatter);
var message = String.join("\n", lines.subList(4, lines.size()));
var message = String.join("\n", lines.subList(4, lines.size() - 1)); // Git adds newline

return Optional.of(new Tag.Annotated(name, target, author, date, message));
}
@@ -1368,7 +1368,7 @@ public Optional<Tag.Annotated> annotate(Tag tag) throws IOException {
var rev = parts[0].substring(0, parts[0].length() - 1).trim(); // skip last ':' and ev. whitespace
var hash = resolve(rev).orElseThrow(IOException::new);
var commit = lookup(hash).orElseThrow(IOException::new);
var message = String.join("\n", commit.message()) + "\n";
var message = String.join("\n", commit.message());
return Optional.of(new Tag.Annotated(tagName, target, commit.author(), commit.authored(), message));
}
}
@@ -2077,7 +2077,7 @@ void testAnnotateTag(VCS vcs) throws IOException {
Files.writeString(readme, "Hello\n");
repo.add(readme);
var head = repo.commit("Added README", "duke", "duke@openjdk.org");
var tag = repo.tag(head, "1.0", "Added tag 1.0 for HEAD\n", "duke", "duke@openjdk.org");
var tag = repo.tag(head, "1.0", "Added tag 1.0 for HEAD", "duke", "duke@openjdk.org");
var annotated = repo.annotate(tag).get();

assertEquals("1.0", annotated.name());
@@ -2088,7 +2088,7 @@ void testAnnotateTag(VCS vcs) throws IOException {
assertEquals(now.getDayOfYear(), annotated.date().getDayOfYear());
assertEquals(now.getHour(), annotated.date().getHour());
assertEquals(now.getOffset(), annotated.date().getOffset());
assertEquals("Added tag 1.0 for HEAD\n", annotated.message());
assertEquals("Added tag 1.0 for HEAD", annotated.message());
}
}

1 comment on commit 6c52d67

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 6c52d67 Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.