-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix git.parseTagData #14105
Fix git.parseTagData #14105
Conversation
@lunny thanks - good 👀! EDIT: just saw the test error log too 🙃 |
We need to do something slightly different here. The issue is a that parseTagData is sometimes passed the terminal newline and sometimes not. I think your code potentially is correct without the terminal newline but all of the rest of the calls need to be similarly limited. Our unit tests should probably use []byte arrays too. |
@zeripath while test git migration from repo in reported issue ... out of 177 tags only 2 tags executed this function So its not crear to me why this function exist ... Is it some sort of workaround? |
This comment has been minimized.
This comment has been minimized.
The function exists because most tags in that repo are not annotated tags. parseTagData only applies to annotated tags. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
The TestAPIGitTags is also fundamentally incorrect because the message is always trimmed and terminated with a new line with -m |
Signed-off-by: Andrew Thornton <art27@cantab.net>
assert.EqualValues(t, test.tag.Signature.Payload, tag.Signature.Payload) | ||
} else { | ||
assert.Nil(t, tag.Signature) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the fixture data which defined above (testData
) this: if test.tag.Signature != nil
is from my understanding always nil
? That would mean that the given if ... else
is not necessary... Or do I misunderstand a thing here?
If it should not nil in some cases then some testData is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be simplified a bit yes
In sort, it's a custom assert.EqualValues(t, test.tag, tag)
... witch would be false in any case ... :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry took a bit of time that you control the checking of the result of parseTagData based on the content of the fixture (testData)... now it makes sense to me... just missed that point.
} else { | ||
assert.Nil(t, tag.Tagger) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here from my point of view the same thing because test.tag.Tagger
would always not nil ?... WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In short it 1. Check if value is expected ... 2. check if actual value is not nil (with assert test statement)
if expect & real is NOT nil, it checks the values
else (test already failed if expect != real, or nil is exptected - so...) test if result is nil
fix #14092