Skip to content

Commit

Permalink
[fix] chmod 0777 the newly created file; Fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd-Eden committed Dec 12, 2016
1 parent 1689e3e commit 3ecafe0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ catch (e) {}
// as stashing - unstashing the unstaged changes)
// TODO: we could keep launching the old pre-commit scripts
var hookRelativeUnixPath = hook.replace(root, '.');

if(os.platform() === 'win32') {
hookRelativeUnixPath = hookRelativeUnixPath.replace(/[\\\/]+/g, '/');
}

var precommitContent = '#!/bin/bash' + os.EOL
+ hookRelativeUnixPath + os.EOL
+ 'RESULT=$?' + os.EOL
Expand All @@ -73,3 +75,11 @@ catch (e) {
console.error('pre-commit: The hook was not installed.');
console.error('pre-commit:');
}

try { fs.chmodSync(precommit, 777); }
catch (e) {
console.error('pre-commit:');
console.error('pre-commit: chmod 0777 the pre-commit file in your .git/hooks folder because:');
console.error('pre-commit: '+ e.message);
console.error('pre-commit:');
}

0 comments on commit 3ecafe0

Please sign in to comment.