Skip to content

Commit

Permalink
Replace topLevelDir with cwd as they return same result
Browse files Browse the repository at this point in the history
Using node cwd() is less code and more recognisable function to understand in a mostly node environment.
  • Loading branch information
rkotze committed Jan 16, 2019
1 parent fb777d9 commit 7fa152a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions src/git-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ function insideWorkTree() {
return silentRun('git rev-parse --is-inside-work-tree').status === 0;
}

/**
* Computes the path to the top-level directory of the git repository.
* @returns {string} Path to the top-level directory of the git repository.
*/
function topLevelDirectory() {
return silentRun('git rev-parse --show-toplevel').stdout.trim();
}

module.exports = {
version: gitVersion,
config: {
Expand All @@ -141,6 +133,5 @@ module.exports = {
revParse: {
gitPath,
insideWorkTree,
topLevelDirectory,
},
};
2 changes: 1 addition & 1 deletion src/git-message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function commitTemplatePath() {
return (
process.env.GITMOB_MESSAGE_PATH ||
config.get('commit.template') ||
path.relative(revParse.topLevelDirectory(), gitMessagePath())
path.relative(process.cwd(), gitMessagePath())
);
}

Expand Down

0 comments on commit 7fa152a

Please sign in to comment.