Skip to content

Commit

Permalink
chore: fix git commit-msg hook to work with git gui
Browse files Browse the repository at this point in the history
Because git gui uses `GITGUI_EDITMSG` instead of `COMMIT_EDITMSG`.
  • Loading branch information
vojtajina committed Feb 3, 2013
1 parent 600f194 commit 9cdaf77
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tasks/lib/validate-commit-msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
var fs = require('fs');
var util = require('util');
var path = require('path');


var MAX_LENGTH = 70;
Expand Down Expand Up @@ -84,11 +85,10 @@ var firstLineFromBuffer = function(buffer) {
// publish for testing
exports.validateMessage = validateMessage;


// hacky start if run by git
var commitMsgFile = process.argv[2];
if (commitMsgFile && commitMsgFile.indexOf('COMMIT_EDITMSG') !== -1) {
var incorrectLogFile = commitMsgFile.replace('COMMIT_EDITMSG', 'logs/incorrect-commit-msgs');
// lame test if run by git (so that it does not trigger during testing)
if (process.env.GIT_DIR) {
var commitMsgFile = process.argv[2];
var incorrectLogFile = path.dirname(commitMsgFile) + '/logs/incorrect-commit-msgs';

fs.readFile(commitMsgFile, function(err, buffer) {
var msg = firstLineFromBuffer(buffer);
Expand Down

0 comments on commit 9cdaf77

Please sign in to comment.