usethis
usethis copied to clipboard
`git_vaccinate()` drops blank lines and repeated comments
git_vaccinate() calls write_union() to update the global gitignore file and write_union() keeps only unique lines.
https://github.com/r-lib/usethis/blob/e9a3c8299c132f9fc8a630886e26c36668f427c7/R/write.R#L61
Unfortunately this deletes all empty lines (but the first) and repeated comments, such as those often used around section headings, e.g.
value = 123
########################
# A new section #
########################
value2 = 456
Becomes
value = 123
########################
# A new section #
value2 = 456
Since you are already doing a set diff of the new lines and the existing lines, couldn't you just prepend the new lines rather than taking the union to avoid this? e.g. change that line to
all <- c(new, existing_lines)
Yeah, good call.
I'll do this one.