Skip to content

Commit

Permalink
Merge pull request #29 from Sarabadu/fix/nfnd-gitmessage
Browse files Browse the repository at this point in the history
Fix/nfnd gitmessage. Closes #25
  • Loading branch information
dideler authored Jun 10, 2018
2 parents fba05b2 + b4a7344 commit 8075095
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ function removeSection(section) {
* @returns {string} Relative path to "$GIT_DIR/<path>"
*/
function gitPath(path) {
return silentRun(`git rev-parse --git-path ${path}`).stdout.trim();
const version = silentRun('git --version').stdout.trim();
const [, mayor, minor] = /.*(\d)\.(\d*)\.(\d*)/gm.exec(version);

if (mayor >= 2 && minor >= 13) {
return silentRun(` git rev-parse --git-path ${path}`).stdout.trim();
}

return silentRun(`git rev-parse --show-cdup | tr -d '\n' && git rev-parse --git-path ${path}`).stdout.trim();
}

/**
Expand Down

0 comments on commit 8075095

Please sign in to comment.