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

Remove trailing whitespace #773

Merged

Conversation

JasonGross
Copy link
Contributor

With

git grep --name-only ' $' '*.v' | xargs sed -i 's/\s\+$//g'

(Not sure if you want this sort of PR, but it makes development a bit easier for me because my editor autoremoves trailing whitespace)

@TheoWinterhalter
Copy link
Member

I agree that trailing whitespaces have no place in the development.

@JasonGross
Copy link
Contributor Author

What's the process for getting this merged?

@TheoWinterhalter
Copy link
Member

I personally don't mind, but this is a commit that might induce a lot of pain (as in conflict) if other developers have unmerged content. @mattam82 @yforster @MevenBertrand would you happen to know?

@JasonGross
Copy link
Contributor Author

According to the docs, it shouldn't be hard to rebase on top of a whitespace-only change. The following procedure should work (I haven't tested though):

  1. git rebase ${WHITE_SPACE_SHA}^, resolve any conflicts --- this will bring the branch up to date with the commit right before the whitespace change
  2. git rebase -Xignore-space-at-eol ${WHITE_SPACE_SHA} --- this should (hopefully) rebase atop the whitespace change without conflicts
  3. (optional) git rebase --whitespace=fix ${WHITE_SPACE_SHA} --- this should (hopefully) strip any newly introduced trailing whitespace
  4. git rebase coq-8.16 (or whatever branch)

@yforster
Copy link
Member

yforster commented Nov 8, 2022

My biggest worry here would be that we get lots of clashes with the work on SProp by @yannl35133. I have unmerged stuff, but its mostly self-contained. @kyoDralliam also has new things, but I think as of now also mostly self-contained.

@JasonGross
Copy link
Contributor Author

My biggest worry here would be that we get lots of clashes with the work on SProp by @yannl35133.

Is this #708? It has a bunch of merge conflicts with coq-8.16 (even with coq-8.14), but I've tested the above strategy by finding the git merge-base upstream/coq-8.14 upstream/sprop (giving afb2b5a), adding a commit on top of that with git grep --name-only ' $' '*.v' | xargs sed -i 's/\s\+$//g' && git commit -am "Remove whitespace" && export WHITE_SPACE_SHA="$(git rev-parse HEAD)", and then doing

git rebase ${WHITE_SPACE_SHA}^
git rebase -Xignore-space-at-eol ${WHITE_SPACE_SHA}
git diff --name-only --diff-filter=U | xargs git rm && GIT_EDITOR=true git rebase --continue

The third line is needed because there was one commit that deleted a file with a whitespace change, which -Xignore-space-at-eol doesn't handle as per https://stackoverflow.com/a/54232519/377022

So this strategy seems to work fine

@yforster
Copy link
Member

Let's wait for #783 and #781, then we can fix the conflicts here and merge

@mattam82
Copy link
Member

I'm fine with removing whitespace. I think @yannl35133 actually wanted that as well, IIRC.

@TheoWinterhalter
Copy link
Member

We could also imagine having a linter for this. But the best is simply for everyone to use an editor that does not introduce them in the first place?

@yforster
Copy link
Member

But the best is simply for everyone to use an editor that does not introduce them in the first place?

Can we have a vscode option in the workspace file that's in the repo anyways?

@TheoWinterhalter
Copy link
Member

But the best is simply for everyone to use an editor that does not introduce them in the first place?

Can we have a vscode option in the workspace file that's in the repo anyways?

We could, but it's also on by default no?

@yforster
Copy link
Member

I think

"files.trimTrailingWhitespace": false

is the default

@TheoWinterhalter
Copy link
Member

Then I'm all for changing it in the repo.

@yforster
Copy link
Member

I confirmed this by running "Preferences: Open default settings (JSON)"

@yannl35133
Copy link
Contributor

Rebasing SProp to Coq 8.16 is going to be non-trivial in any case, so I'm fine with dealing with this when I'll do it.

With
```
git grep --name-only ' $' '*.v' | xargs sed -i 's/\s\+$//g'
```
@JasonGross
Copy link
Contributor Author

Let's wait for #783 and #781, then we can fix the conflicts here and merge

I've fixed the conflicts, this should be ready for merge

@JasonGross
Copy link
Contributor Author

https://github.com/MetaCoq/metacoq/actions/runs/3516675088/jobs/5894539090 seems to have been running for half an hour already after completing the "Complete Job" step...

@JasonGross
Copy link
Contributor Author

CI passed, this is ready for merge

@TheoWinterhalter TheoWinterhalter merged commit 075e6a7 into MetaCoq:coq-8.16 Nov 21, 2022
@JasonGross JasonGross deleted the coq-8.16+remove-trailing-ws branch November 21, 2022 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants