seymen / git-last-commit

Node.js module to read last git commit information including tags and branch
MIT License
50 stars 19 forks source link

Should execute the git command in the context of the working directory #16

Open theogravity opened 4 years ago

theogravity commented 4 years ago

I wrote this tool to update changelogs with the latest git commit info, and I noticed when I install it globally, the git info seems to be coming from the global path to which it was installed to, vs the working directory of my project.

If I install it locally to the project and execute it via npm run, then there's no problem.

Can we get an option to set the execution context of the git command to pwd()?

J4YF7O commented 3 years ago

It's possible.

Look at https://github.com/seymen/git-last-commit/blob/master/source/index.js#L7-L9

An option params is available as 2nd param, and you can set {dst: proccess.pwd()}

It could be interesting to create an MR to add the "option" parameter in typescript definiton.