convco: `Check` returns `empty commit message` in version 0.3.13

Describe the bug The command convco check started return empty commit message in version 0.3.13. When running the same command with version 0.3.12 the tool finds the commit, and validates it properly. I haven’t found any documentation about any behavior change with the check command, hence this bug report.

To Reproduce Steps to reproduce the behavior:

  1. Clone convco repo: https://github.com/convco/convco.git
  2. Ensure local convco version 0.3.13 with convco --version
  3. Run convco check
  4. See error empty commit message

Expected behavior Expect output to be the same as with version 0.3.12, i.e:

FAIL  38be02d  wrong type: doc  doc: clarify cmake is needed to build
FAIL  8c4dbb6  wrong type: doc  doc: improve gitlab section in `README.m...
FAIL  ffcf34a  scope does not match regex: changelog|check|commit|version  ci(docker): Add a dockerfile
FAIL  724bb2b  first line doesn't match `<type>[optional scope]: <description>`  release v0.3.0
FAIL  155e652  scope does not match regex: changelog|check|commit|version  build(deps): bump versions

5/167 failed

System (please complete the following information):

  • OS: ubuntu
  • Version: 20.04

Additional context Not sure if this is a bug or an actual change of behavior, couldn’t find any changes in the documentation though, so I assume that it indeed a bug. If this behavior change is as intended, it would be good to update the documentation and then you can just close this bug.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20

Commits related to this issue

Most upvoted comments

No problem, thank you for reporting the issue. #116 will introduce the --stdin option instead of the detection of tty or not.

@ite-klass

As this is a pre-major release anything can change. I try to do my best to not introduce breaking changes, but this one was unexpected. I propose to pin to v0.3.12 for the time being.

https://semver.org/#spec-item-4 Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

As you run it with Jenkins, I guess no tty is available. There is still a bug I need to fix. I should have taken more time to test this, but my spare time is sparse.

diff --git a/src/cmd/check.rs b/src/cmd/check.rs
index 53be1f3..73cc6d6 100644
--- a/src/cmd/check.rs
+++ b/src/cmd/check.rs
@@ -64,7 +64,7 @@ impl Command for CheckCommand {
 
         let Config { merges, .. } = config;
 
-        if self.rev.is_some() && !stdin().is_terminal() {
+        if self.rev.is_none() && !stdin().is_terminal() {
             let mut stdin = stdin().lock();
             let mut commit_msg = String::new();
             stdin.read_to_string(&mut commit_msg)?;

update: with this change you will have to set convco check HEAD if convco runs not in a tty.