Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-04-04 17:36:44

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Trouble diffing exported theme files

This is my first time deploying significant changes to a site using Textpattern’s native theme functionality instead of cnk_versioning.

Just to be safe, I wanted to check if any changes were made using Textpattern’s template editor. So before I imported my revisions from the latest directory in version control, I exported the existing theme files. I thought I could quickly compare the exported directory against my latest directory from version control using diff, as follows:

diff -ur {exported_directory} {new_directory}

That gave me quite a diff! Out of 77 files, 69 showed changes. Most of the changes showed me that one version or the other had “No newline at end of file”. Many of them showed that one version of the file used a different newline character for every line in the file.

Since I’m the only one editing these files, and I almost never use Textpattern’s editor, it seems absurd that this happened due to a human opening these templates and saving them in Textpattern—much less making any substantial changes. But having diff return almost every file as changed makes it onerous to sort out which files actually do have changes.

Has anyone else experienced this, or something like it? Can anyone suggest any steps I might take to troubleshoot this issue, or avoid it in the future?

Thank you!

Edit: Fix textile on code block.

Last edited by johnstephens (2019-04-04 17:37:36)

Offline

#2 2019-04-04 18:09:30

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: Trouble diffing exported theme files

Try using -w and/or --strip-trailing-cr with the diff command to ignore whitespace changes and final carriage return, e.g.

diff -urw {exported_directory} {new_directory}

or

diff -ur --strip-trailing-cr {exported_directory} {new_directory}

TXP Builders – finely-crafted code, design and txp

Offline

#3 2019-04-04 18:10:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,595
Website

Re: Trouble diffing exported theme files

The reason is probably simply because the export pattern from textpattern is different to the one in your text editor, e.g. spaces vs. tab or save with final carriage return.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2019-04-04 18:36:59

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: Trouble diffing exported theme files

Thank you, @jakob!

Offline

Board footer

Powered by FluxBB