1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-08-16 18:30:30 +03:00

fix: read before opening the file to prepend

This commit is contained in:
DaniPopes 2024-06-26 00:59:23 +02:00
parent 11533e8a16
commit b6d2a219c6
No known key found for this signature in database
GPG Key ID: 0F09640DDB7AC692

View File

@ -569,8 +569,9 @@ pub fn run(mut args: Opt) -> Result<()> {
}
if let Some(path) = &args.prepend {
let changelog_before = fs::read_to_string(path)?;
let mut out = io::BufWriter::new(File::create(path)?);
changelog.prepend(fs::read_to_string(path)?, &mut out)?;
changelog.prepend(changelog_before, &mut out)?;
}
if args.output.is_some() || args.prepend.is_none() {
changelog.generate(&mut out)?;