Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get top-level path from git itself #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion install.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ var fs = require('fs')
, os = require('os')
, hook = path.join(__dirname, 'hook')
, root = path.resolve(__dirname, '..', '..')
, spawn = require('child_process').spawnSync

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvasilakis Could you please correct it to

Suggested change
, spawn = require('child_process').spawnSync
, spawn = require('child_process').spawn

By https://stackoverflow.com/a/44643419/1535127 it is the fix of Travis build here and quite anticipated fix in this repo.

, tl = spawn('git', ['rev-parse', '--show-toplevel']).stdout.toString().trim()
, exists = fs.existsSync || path.existsSync;


//
// Gather the location of the possible hidden .git directory, the hooks
// directory which contains all git hooks and the absolute location of the
Expand All @@ -27,7 +30,7 @@ function getGitFolderPath(currentPath) {
console.log('pre-commit:');
console.log('pre-commit: Not found .git folder in', git);

var newPath = path.resolve(currentPath, '..');
var newPath = tl || path.resolve(currentPath, '..');

// Stop if we on top folder
if (currentPath === newPath) {
Expand Down