You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/10/06 10:46:06 UTC
cordova-coho git commit: CB-9739 Prevent coho from creating broken
packages including CRLF on Windows
Repository: cordova-coho
Updated Branches:
refs/heads/master 9a089f32f -> 2fd896e49
CB-9739 Prevent coho from creating broken packages including CRLF on Windows
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/2fd896e4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/2fd896e4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/2fd896e4
Branch: refs/heads/master
Commit: 2fd896e49099759fb42ddef12976bbeaae428716
Parents: 9a089f3
Author: daserge <v-...@microsoft.com>
Authored: Fri Oct 2 15:09:56 2015 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Mon Oct 5 22:18:32 2015 +0300
----------------------------------------------------------------------
src/create-verify-archive.js | 48 +++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/2fd896e4/src/create-verify-archive.js
----------------------------------------------------------------------
diff --git a/src/create-verify-archive.js b/src/create-verify-archive.js
index 15e1d12..d5426ee 100644
--- a/src/create-verify-archive.js
+++ b/src/create-verify-archive.js
@@ -30,6 +30,7 @@ var gitutil = require('./gitutil');
var repoutil = require('./repoutil');
var print = apputil.print;
var settingUpGpg = path.resolve(path.dirname(__dirname), 'docs', 'setting-up-gpg.md');
+var isWin = process.platform === 'win32';
exports.createCommand = function*(argv) {
var opt = flagutil.registerRepoFlag(optimist)
@@ -76,6 +77,10 @@ exports.createCommand = function*(argv) {
var absOutDir = path.resolve(outDir);
yield repoutil.forEachRepo(repos, function*(repo) {
+ if(isWin) {
+ yield checkLineEndings(repo);
+ }
+
var tag = argv.tag || (yield gitutil.findMostRecentTag(repo.versionPrefix));
if (!tag) {
apputil.fatal('Could not find most recent tag. Try running with --tag');
@@ -171,3 +176,46 @@ function *computeHash(path, algo) {
function extractHashFromOutput(output) {
return output.slice(output.lastIndexOf(':') + 1).replace(/\s*/g, '').toLowerCase();
}
+
+function *checkLineEndings(repo) {
+ var autoCRLF;
+ var eol;
+ var msg = '';
+
+ try {
+ autoCRLF = yield executil.execHelper(executil.ARGS('git config --get core.autocrlf'), true);
+ } catch(e) {
+ autoCRLF = '';
+ }
+
+ try {
+ eol = yield executil.execHelper(executil.ARGS('git config --get core.eol'), true);
+ } catch(e) {
+ eol = '';
+ }
+
+ if(autoCRLF !== 'false') {
+ msg = 'Warning: core.autocrlf is set to "' + autoCRLF + '".\n' +
+ 'Set either "' + repo.repoName + '" or global core.autocrlf setting to "false" to avoid issues with executables on non-Windows OS.\n';
+ }
+
+ if(eol !== 'lf') {
+ msg += 'Warning: core.eol is set to "' + eol + '". Set it to "lf" to normalize line endings.\n';
+ }
+
+ if(!!msg) {
+ console.error(msg +
+ 'Run these commands in the repos:\n' +
+ ' git config core.eol lf\n' +
+ ' git config core.autocrlf false\n' +
+ ' git rm --cached -r .\n' +
+ ' git reset --hard\n' +
+ 'Alternatively you can setup it globally for your user:\n' +
+ ' git config --global core.eol lf\n' +
+ ' git config --global core.autocrlf false\n' +
+ 'Or update the repos automatically using coho (change the repo groups to your ones):\n' +
+ ' coho for-each -r tools -r android -r ios -r windows "git config core.eol lf && git config core.autocrlf false && git rm --cached -r . && git reset --hard"');
+
+ process.exit(1);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org