Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Unify Windows and Mac git commit call
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Asselin committed Jan 12, 2015
1 parent bd06dd9 commit cba71b2
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit cba71b2

Please sign in to comment.