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
opts/envfile: trim all leading whitespace in a line #15762
Conversation
testcases? |
Yeah, adding now. :) |
@duglin test added, which fails before this patch, but passes after patch. |
LGTM |
// because it's common for editors to trim trailing whitespace | ||
// from lines, which becomes annoying since that's the | ||
// exact thing we need to test. | ||
content += "\n " |
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.
Do we need a similar test, using a tab
as whitespace?
Also, this looks to be adding trailing whitespace (the whitespace is appended to the content), not leading whitespace, is that correct?
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.
think I misread the description of the PR, got confused because of the "trim the first line" in your PR description
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, I see the misunderstanding, but it says "trim the line first" NOT "trim the first line". ;)
tl;dr, if there's a line with only whitespace, docker would error before.
Do we need a similar test, using a tab as whitespace?
I could just add a \t
into this line as well to cover both.
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.
Doh! You're right, probably combined with the "trim leading" title of the PR, I got completely lost LOL
I could just add a \t into this line as well to cover both
Saw you added it, thanks!
cb636d9
to
299f2be
Compare
Signed-off-by: Matt Robenolt <matt@ydekproductions.com>
LGTM |
opts/envfile: trim all leading whitespace in a line
Rather than just trimming before a variable, we should trim the line first.
This prevents a line with whitespace only to not break docker.