Skip to content

Signed-off-by error #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adam-moss opened this issue Aug 7, 2017 · 14 comments
Closed

Signed-off-by error #59

adam-moss opened this issue Aug 7, 2017 · 14 comments
Labels

Comments

@adam-moss
Copy link
Contributor

adam-moss commented Aug 7, 2017

I've identified an error when using the signed-off-by key, when git commit --amend --no-edit or git commit --amend with or without the --signoff option is being used, following git commit --signoff event. Haven't had a chance to look at it yet but it is a little odd since it is part of the commit message itself...

@marionebl
Copy link
Contributor

I think I do not understand the actual problem, could you elaborate?

@adam-moss
Copy link
Contributor Author

Yeah, basically if you require signoff and do a commit with --signoff, all is good.

If you then go and edit that commit via either of the above methods it fails the commitlint rule saying it must be signed off.

Which is a little weird, since the Signed-off-by: text is obviously in the commit message at that point.

@marionebl
Copy link
Contributor

Could you provided the input and error output? Helps me with researching this later on.

@marionebl marionebl added the bug label Aug 14, 2017
@marionebl
Copy link
Contributor

@adam-moss As I personally do not use signoff, this is not actionable for me without detailed steps to reproduce. Are you still interested in this?

@adam-moss
Copy link
Contributor Author

Yes, sorry, let me dig out the details for you, I totally forgot to send them on!

@marionebl
Copy link
Contributor

@adam-moss Any news? Without further information I'd close this.

@adam-moss
Copy link
Contributor Author

Yes. So basically in you create an empty folder, git init and npm install commitlint husky and then create a commitlint.config.js per:

    rules: {
        'signed-off-by': [ 2, 'always' ]
    }
};

Then touch test, git add test git commit --signoff -m 'test' then do a git commit --amend --no-edit you get:


⧗   input: test
✖   message must be signed off [signed-off-by]
✖   found 1 problems, 0 warnings

However if you git log:

Author: adam moss <[email protected]>
Date:   Thu Dec 7 08:59:09 2017 +0000

    test
    
    Signed-off-by: adam moss <[email protected]>

Which you can also see if you just do a git commit --amend.

So the signoff is there, but an error is still being raised.

@marionebl
Copy link
Contributor

Thanks, the test case helps a lot!

@marionebl
Copy link
Contributor

I added a test for this here: https://github.com/marionebl/commitlint/blob/949579ccf1d30af66681208f0bbba07ea14d7597/%40commitlint/cli/src/cli.test.js#L171

Your example uses the rule without value:

'signed-off-by': [ 2, 'always' ]

while the test case uses

https://github.com/marionebl/commitlint/blob/949579ccf1d30af66681208f0bbba07ea14d7597/%40commitlint/cli/fixtures/signoff/commitlint.config.js#L3

Any chance the issue goes away when changing your config accordingly?

@adam-moss
Copy link
Contributor Author

Thought I was going to have a total facepalm moment there!

It partially resolves it:
git commit --amend --no-edit does not result in an error
git commit --amend still does, even though the previous Signed-off-by text is present in the commit message.

Adding --signoff has no effect on the outcome.

Cheers

@marionebl
Copy link
Contributor

marionebl commented Dec 8, 2017

Can reproduce that.

The problem here is that commitlint uses the contents of .git/COMMIT_EDIT_MSG, which does not include Signed-off-by while the final commit message does. Based on the given input the rule correctly detects a violation. git commit --amend --signoff works, though.

I think that is something commitlint can't fix with reasonable effort. What do you think?

@adam-moss
Copy link
Contributor Author

Yes, I'd agree with your assessment, ticket closed 👍

@awilkins
Copy link

awilkins commented Jan 9, 2019

Fancy meeting you here, @adam-moss ... I resorted to git commit --amend --signoff --no-verify for these commits.

@adam-moss
Copy link
Contributor Author

Hehe, it was my MR that added the functionality 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants