usethis icon indicating copy to clipboard operation
usethis copied to clipboard

`use_version()` leaves behind development header if preceding newlines exist in NEWS

Open kevinushey opened this issue 2 months ago • 0 comments

In renv, I had a NEWS file with the structure:


# renv (development version)

* Fixed an issue where downloads could fail with curl >= 8.7.1. (#1869)

< ... >

Note the leading empty line. When I then ran usethis::use_version("patch"), the NEWS file was modified as:

diff --git a/NEWS.md b/NEWS.md
index bc58b2c79..d2b02c0da 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,5 @@
+# renv 1.0.6
+

 # renv (development version)

Note that the old development version NEWS header was unexpectedly retained. Could the check in:

https://github.com/r-lib/usethis/blob/9e64daf13ac1636187d59e6446d9526a414d8ba6/R/news.R#L49-L55

skip leading whitespace / empty lines?

kevinushey avatar Apr 11 '24 05:04 kevinushey