Skip to content

Commit

Permalink
fix: change git command used for obtaining commits between closest ta…
Browse files Browse the repository at this point in the history
…g and current commit
  • Loading branch information
lopezd authored and dloez committed Aug 25, 2023
1 parent 84e5704 commit 779ab2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ pub fn get_commit_messages(
let output_result = Command::new("git")
.arg("log")
.arg("--format=%s")
.arg(from_commit)
.arg(until_commit)
.arg("--ancestry-path")
.arg(format!("{}..{}", from_commit, until_commit))
.output();

let output = match output_result {
Expand Down Expand Up @@ -160,14 +160,7 @@ pub fn get_commit_messages(
}

let stdout = String::from_utf8_lossy(&output.stdout).to_string();
let mut iterator = stdout.lines().map(|s| s.to_owned());
let mut commit_messages = Vec::new();
while let Some(line) = iterator.next() {
if iterator.clone().next().is_some() {
commit_messages.push(line);
}
}
Ok(commit_messages)
Ok(stdout.lines().map(|s| s.to_owned()).collect())
}

pub fn create_tag(tag: &String, tag_message: &String) -> Result<(), Error> {
Expand Down
2 changes: 1 addition & 1 deletion src/source/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl SourceActions for GitSource {
Err(error) => return Err(error),
};

self.commit_messages = match git::get_commit_messages(&sha, &self.closest_tag_commit_sha) {
self.commit_messages = match git::get_commit_messages(&self.closest_tag_commit_sha, &sha) {
Ok(commit_messages) => commit_messages,
Err(error) => return Err(error),
};
Expand Down

0 comments on commit 779ab2b

Please sign in to comment.