Skip to content

Commit

Permalink
fix: commit messages trim when special chars present (#2)
Browse files Browse the repository at this point in the history
## Summary

Commit messages with special characters where being trimmed. This PR
addresses that by changing the regex to capture everything less a new
line after a colon.

closes #1
  • Loading branch information
mstrk authored May 21, 2024
2 parents 3da3642 + 08fe2af commit 40afd17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Changelog {
};

// save a reference to the first line to be used later if needed
let pattern = r"^(TOKENS){1}(\([\w\-\.]+\))?(!)?: ([\w ]+)";
let pattern = r"^(TOKENS){1}(\([\w\-\.]+\))?(!)?: (.+)";
let pattern = pattern.replace(
"TOKENS",
release_types.join("|").as_str(),
Expand Down Expand Up @@ -76,7 +76,7 @@ impl Changelog {
// is not in the range of release_types but it's still relevant for the changelog
// because it contains a breaking change, which should trigger a major release.
if commit.section_type.is_empty() {
let re = Regex::new(r"^(\w+)(\([\w\-\.]+\))?(!)?: ([\w ]+)").unwrap();
let re = Regex::new(r"^(\w+)(\([\w\-\.]+\))?(!)?: (.+)").unwrap();
let caps = re.captures(&git_commit.subject);
match caps {
Some(caps) => {
Expand Down
7 changes: 4 additions & 3 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ impl Git {
bail!("There are uncommitted changes. Please commit or stash them before running donder-release.");
}

// removed because it was causing git merge conflicts - the user must make sure the local branch is up to date
// pull changes from remote
Command::new("git")
.args(["pull", &self.repo_url])
.output()?;
// Command::new("git")
// .args(["pull", &self.repo_url])
// .output()?;

// fetch tags from remote
Command::new("git")
Expand Down

0 comments on commit 40afd17

Please sign in to comment.