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

Noise in diffs due to path separators #107

Open
doublemarked opened this issue Aug 19, 2015 · 2 comments
Open

Noise in diffs due to path separators #107

doublemarked opened this issue Aug 19, 2015 · 2 comments

Comments

@doublemarked
Copy link

Hello!

We added a developer to our team that works on Windows. Unfortunately, each time he runs the extractor, the POT file has all its reference filenames changed to have backslashes instead of forward slashes. It produces hundreds of diffs like,

-#: site/home.html:93
+#: site\home.html:93

And of course, the next time one of our unix-based developers regenerates the file, the changes are all reversed.

Considering those are just references, can the format be normalized?

@gabegorelick
Copy link
Collaborator

You can use the postProcess callback to fix this. Here's what my builds look like:

gulp.src(['public/**/*.html', 'public/**/*.js'])
    .pipe(gettext.extract('messages.pot', {
      postProcess: function (po) {
        po.items.forEach(function (item) {
          item.references = item.references.map(function (ref) {
            return path.relative(path.join(__dirname, '../po'), ref)
              .replace(/\\/g, '/'); // replace any Windows-style paths
          });
        });
      }
    }))
    .pipe(gulp.dest('po/'));

That being said, we should consider normalizing paths by default.

@doublemarked
Copy link
Author

Thank you, @gabegorelick !

@gabegorelick gabegorelick changed the title Volatile POT files with cross-platform development due to system path formats Noise in diffs due to path separators Aug 19, 2015
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

No branches or pull requests

2 participants