Skip to content

Commit

Permalink
fix(changelog): don't change the context when provided via `--from-co…
Browse files Browse the repository at this point in the history
…ntext` (#820)

closes /issues/819
  • Loading branch information
weichweich authored Aug 26, 2024
1 parent 7415289 commit ff72406
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions git-cliff-core/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,20 @@ impl<'a> Changelog<'a> {
}
}

/// Adds remote data (e.g. GitHub commits) to the releases.
pub fn add_remote_data(&mut self) -> Result<()> {
debug!("Adding remote data...");
/// Adds information about the remote to the template context.
pub fn add_remote_context(&mut self) -> Result<()> {
self.additional_context.insert(
"remote".to_string(),
serde_json::to_value(self.config.remote.clone())?,
);
Ok(())
}

/// Adds remote data (e.g. GitHub commits) to the releases.
pub fn add_remote_data(&mut self) -> Result<()> {
debug!("Adding remote data...");
self.add_remote_context()?;

#[cfg(feature = "github")]
let (github_commits, github_pull_requests) = if self.config.remote.github.is_set()
{
Expand Down
2 changes: 1 addition & 1 deletion git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ pub fn run(mut args: Opt) -> Result<()> {
Box::new(File::open(context_path)?)
};
let mut changelog = Changelog::from_context(&mut input, &config)?;
changelog.add_remote_data()?;
changelog.add_remote_context()?;
changelog
} else {
// Process the repositories.
Expand Down

0 comments on commit ff72406

Please sign in to comment.