From cba71b2c871522e1f5438a73acad4e0b700d713d Mon Sep 17 00:00:00 2001 From: Andre Asselin Date: Mon, 12 Jan 2015 12:28:18 -0500 Subject: [PATCH] Unify Windows and Mac git commit call --- bin/index.js | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/bin/index.js b/bin/index.js index 6c7ba1a..b0a262f 100755 --- a/bin/index.js +++ b/bin/index.js @@ -47,31 +47,20 @@ function gitCommit(change, next) { var author = name + ' <' + email + '>'; var modified = new Date(change.modified).toISOString(); - if (isWindows) { - // commit these changes - echoAndExec(comment, ['set GIT_COMMITTER_EMAIL="' + email + '"', - '& set GIT_COMMITTER_NAME="' + name + '"', - '& set GIT_COMMITTER_DATE="' + modified + '"', - '& git commit', - '-F -', - '--author="' + author + '"', - '--date=' + modified, - '--allow-empty'].join(' '), { - maxBuffer: maxBuffer - }, next); - } else { - // commit these changes - echoAndExec(null, ['GIT_COMMITTER_EMAIL="' + email + '"', - 'GIT_COMMITTER_NAME="' + name + '"', - 'GIT_COMMITTER_DATE="' + modified + '"', - 'git commit', - '-m "' + comment + '"', - '--author="' + author + '"', - '--date=' + modified, - '--allow-empty'].join(' '), { - maxBuffer: maxBuffer - }, next); - } + var env = process.env; + env["GIT_COMMITTER_EMAIL"] = email; + env["GIT_COMMITTER_NAME"] = name; + env["GIT_COMMITTER_DATE"] = modified; + + // commit these changes + echoAndExec(comment, ['git commit', + '-F -', + '--author="' + author + '"', + '--date=' + modified, + '--allow-empty'].join(' '), { + maxBuffer: maxBuffer, + env: env + }, next); }