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:
parent
11533e8a16
commit
b6d2a219c6
@ -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)?;
|
||||
|
Loading…
Reference in New Issue
Block a user