-
Notifications
You must be signed in to change notification settings - Fork 476
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
Strip leading spaces after line continuation #635
Conversation
Make line continuations strip leading spaces on the next line. This changes what is passed to the shell, so this is a breaking change. However, I don't think that this will break any recipes.
I am doing a Janus run to try to figure out if there are recipes that are likely to be broken. What I'll be looking for are line continuations without a space before the slash, and with leading whitespace on the next line. Like this:
This currently runs |
I could only find one justfile on github that seems to be affected, and opened a PR with a fix. |
Just my two cents. After this broke my justfiles (they are private so no way you would have known) I found this ticket. I think that it would have been nice to make this work like Make in that it stripped all the spaces equal to the indent. I think that is what happens for the shebang polyglot code. |
Ahh, sorry this broke your justfiles. Did they have slashes without spaces before them? Like this:
I think I assumed that having no space before line continuation slashes is less common than it actually is.
Do you mean that in this justfile:
The first line of foo would be:
I.e. two spaces between |
Thanks for reaching out. Yes. This is my example
and justfile
|
Thanks for the examples. Is there a reason that you prefer not stripping leading spaces from the line after a line continuation? My thinking was that you often want to indent the line after a line continuation, to visually distinguish it, but you don't necessarily want to include the whitespace, especially if there is a space before the slash. In this example, if you're using two space indents, you probably don't want two spaces between
If you like putting a space before the slash, as in this example, you can't indent the next line or else you'll get extra spaces:
|
I can for sure change my behavior. I appreciate the conversation. I think that I never liked putting the space before the slash because then i would not be able to indent it in make without adding an extra space. So I guess the change allows one to put the space before the slash without adding extra spaces. I just got used to putting the slash at the end because of that. |
Thanks for the background, I like the new behavior, although it's definitely unfortunate that I introduced an incompatibility with make :/ |
Makes sense. Is there a thought to do the same for the shebang polyglot syntax? |
Shebang recipes should be safe! Shebang recipes are extracted without doing any processing aside from stripping indentation, so any escaping is done by the underlying interpreter, whatever that may be. |
Make line continuations strip leading spaces on the next line.
This changes what is passed to the shell, so this is a breaking change.
However, I don't think that this will break any recipes.