important changes
cargo devel CI / cargo CI (push) Successful in 3m51s Details

This commit is contained in:
Christoph J. Scherr 2024-01-28 01:42:28 +01:00
parent 6701e86c38
commit 499bcdd4c1
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
1 changed files with 15 additions and 15 deletions

View File

@ -22,18 +22,20 @@ impl Changelog {
return Ok(None); return Ok(None);
} }
let mut cmd = Command::new("git"); let mut cmd = Command::new("git");
cmd.arg("log").arg(format!("{}..HEAD", Self::get_last_tag()?,)).arg("--oneline"); cmd.arg("log")
.arg(format!("{}..HEAD", Self::get_last_tag()?,))
.arg("--oneline");
let out = cmd.output()?; let out = cmd.output()?;
// FIXME: this does not catch fancy colors // FIXME: this does not catch fancy colors, those are from the shell as it seems? I don't
let buf = String::from_utf8(out.stdout).map_err(|err|{ // get it.
ChangelogError::GitUTF8Error(err) let buf = String::from_utf8(out.stdout).map_err(|err| ChangelogError::GitUTF8Error(err))?;
})?;
if !out.status.success() { if !out.status.success() {
return Err( // TODO: get the stderr for error reporting
ChangelogError::GitBadStatus(out.status, buf).into() // TODO: Make the error more understandable for the user
) return Err(ChangelogError::GitBadStatus(out.status, buf).into());
} }
dbg!(&buf);
Ok(Some(buf)) Ok(Some(buf))
} }
@ -41,16 +43,14 @@ impl Changelog {
let mut cmd = Command::new("git"); let mut cmd = Command::new("git");
cmd.arg("describe").arg("--tags").arg("--abbrev=0"); cmd.arg("describe").arg("--tags").arg("--abbrev=0");
let out = cmd.output()?; let out = cmd.output()?;
let buf = String::from_utf8(out.stdout).map_err(|err|{ let buf = String::from_utf8(out.stdout).map_err(|err| ChangelogError::GitUTF8Error(err))?;
ChangelogError::GitUTF8Error(err)
})?;
if !out.status.success() { if !out.status.success() {
return Err( // TODO: get the stderr for error reporting
ChangelogError::GitBadStatus(out.status, buf).into() // TODO: Make the error more understandable for the user
) return Err(ChangelogError::GitBadStatus(out.status, buf).into());
} }
let buf = buf.replace("\n", ""); let buf = buf.replace("\n", "");
return Ok(buf) return Ok(buf);
} }
} }