Skip to content
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

indent: fix tab replace on OSX #3060

Merged
merged 1 commit into from May 28, 2019

Conversation

tjhei
Copy link
Member

@tjhei tjhei commented May 27, 2019

sed is weird on OSX as it doesn't understand \t. Work around this.

@tjhei
Copy link
Member Author

tjhei commented May 27, 2019

@gassmoeller FYI

@gassmoeller
Copy link
Member

Looks good, did you test this on your Mac? If so, feel free to merge.

contrib/utilities/indent Outdated Show resolved Hide resolved
sed -e 's/\t/ /g' $f >$f.tmp
# awkward tab replacement because of OSX sed, do not change onless you test it on OSX
TAB=$'\t'
sed -e "s/$TAB/ /g" $f >$f.tmp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does $'\t' yield the string expansion of \t?

I'll note that that just expands tabs into two spaces. That's not what tabs do -- they expand to a number of spaces necessary to get to the next multiple of 8 characters (or whatever you set the tab width to). This is likely going to lead to some ugly text...

Copy link
Member Author

@tjhei tjhei May 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does $'\t' yield the string expansion of \t?

It will yield the actual tab character (instead of \ followed by t), see https://stackoverflow.com/a/2623007

I'll note that that just expands tabs into two spaces.

Correct, but this is what is happening on master already (I think you reviewed the patch: #3035). It probably doesn't look pretty, but the point is to fail on the tester if you try to commit files with tabs in them. This PR just makes it work on OSX.

This is likely going to lead to some ugly text...

I already made all changes in #3035 but it is not that bad.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I thought about that in #3035 where I did think that it looked ugly. Oh well.

sed is weird on OSX as it doesn't understand \t. Work around this.
@gassmoeller
Copy link
Member

Looks good.

@gassmoeller gassmoeller merged commit ccf0a23 into geodynamics:master May 28, 2019
@tjhei tjhei deleted the fix_indent_on_osx branch May 28, 2019 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants