Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcs: don't append newlines to tag messages #734

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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());
}
}