Skip to content

No newline between prepended block and old content when using --prepend #1524

@jobcespedes

Description

@jobcespedes

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When using the --prepend option to insert new content at the top of an existing changelog file, there is no blank line between the newly prepended block and the original content. This causes the two sections to run into each other without the expected spacing.

This is especially obvious when both the prepended block (e.g., new generated changelog entries) and the old content (previous changelog) have headings: they appear directly one after another, harming readability.

Steps To Reproduce

  1. Generate a changelog with git-cliff and output it to a file (e.g., CHANGELOG.md)
  2. Make additional commits
  3. Run git-cliff again with --prepend CHANGELOG.md to add new changes
  4. Open the file and note there is no blank line between the new section at the top and the previous content.

Expected behavior

There should be at least one blank line (newline) between the prepended (newly generated) content and the existing content in the changelog file when using --prepend. This would ensure the new section is visually separated and readable.

Screenshots / Logs

No response

Software information

  • Operating system: fedora 42
  • Rust version: N/A
  • Project version: 2.13.1

Additional context

Workarounds in the configuration or template body don't reliably solve this. Fixing the join in the implementation of --prepend is more robust. See discussion: #712

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions