tvdstaaij / node-git-describe

Git describe information at runtime, with semver support
36 stars 5 forks source link

long hash? #11

Closed surfjedi closed 5 years ago

surfjedi commented 5 years ago

How do I get long hash?

tvdstaaij commented 5 years ago

You mean the full 40-character SHA-1 commit hash?

I think the only way to do this with git describe on the command line is with the argument --abbrev=40 (or a larger number than 40 to be forward compatible in case Git ever changes to a hash longer than SHA-1).

With this module you can pass the abbrev argument through the customArguments option like this:

gitDescribe(__dirname, {
    customArguments: ['--abbrev=40']
})
     .then((gitInfo) => { /* ... */ })
     .catch((err) => { /* ... */ });