pluralsight / guides-cms

DEPRECATED - Markdown based CMS with Github repository as persistent storage
http://www.pluralsight.com/guides/
GNU Affero General Public License v3.0
108 stars 35 forks source link

Fix line-endings from showing every line as modified when editing guide #65

Closed durden closed 8 years ago

durden commented 8 years ago

Often times we save things with different line-endings, and it creates an incredibly large diff. For example, look at this diff. All I really did in that change was remove the last paragraph, but the entire guide shows up as changed.

Just to verify it's only a white-space/line-endings change you can view this diff. That link goes to Github's 'rich diff', which I assume is just a wrapper for the -b and/or -w arguments to git diff which ignore whitespace/line-ending changes.

@paulocheque What's your recommendation here? Should we just use UNIX-style line-endings with the Ace editor?

paulocheque commented 8 years ago

Yeah, this is a boring thing.

I guess this was caused by changing the line ending without updating the old articles.

I changed the Ace Editor to use unix line-ending in this commit: https://github.com/pluralsight/guides-cms/commit/3d7af7de3ec94179daaa8c700572ffd55d420ca5

And I changed to use GitHub line-endings format in this commit: https://github.com/pluralsight/guides-cms/commit/796beae2b7e47813bb4f81f50acf669569035ece

I guess, if we change an article with the current unix line endings, we will not face this problem anymore.

If I am correct, the best thing would be update all old articles to use the new line end format. Or the old articles will be automatically fixed after the next edition. But of course, the diff will be boring like that one you point out.

durden commented 8 years ago

Did ace ever use UNIX line endings? It looks like your commit 3d7af7d added that but the line was commented out?

paulocheque commented 8 years ago

Oh, I pointed out the wrong commit.

The correct commit is this one: https://github.com/pluralsight/guides-cms/commit/2dda14157effaabbe7dd0d5f8a0f189013459ef4

The old editor I am not sure right now about the line-endings. After we changed to use the Ace Editor, we started with the default value of Ace Editor (probably auto https://ace.c9.io/#nav=api&api=edit_session). Later in this commit we changed to use the unix style only.

durden commented 8 years ago

Good point. I didn't realize we started without unix endings and changed it a few weeks ago. That makes sense. We had a lot of guides submitted before that so that explains why some guides have this diff issue. You're right; we should probably convert every guide. I could write a script to do that, but I think I'll leave it as-is. This way, as you said, each guide will get 'fixed' when it is changed. This way we don't create a bunch of noise with whitespace commits on guides that are already published and not changing.