tvdstaaij / node-git-describe

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

The `hash` output property is prefixed with the VCS indicator #6

Closed plumlee closed 7 years ago

plumlee commented 7 years ago

The commit hash part of the output for git-describe is always prefixed with a 'g', representing git as the VCS being used. It would make the output more useful in a copy/paste situation to strip that character off (or have an option to allow that as the output). I could see this also being more useful in machine parsing the output, although I'm sure most scripts already have a step to do this.

If you're open to this, I'll make a PR.

tvdstaaij commented 7 years ago

Thank you for your suggestion. However, I thought about this a bit but can't defend introducing such an option. That's because:

(1) The module is basically a fancy wrapper around git describe, and prepending a g to the hash is standard and documented behavior of this git command. (2) It's easy to do this with postprocessing in the code that uses this module. For example by taking a substring of hash that skips 1 character and optionally combining that with other properties. If you're interested in the semver string, just call format() on the SemVer instance and add a customized build identifier including the modified hash.

If there is a flaw in my reasoning or if I overlooked something, feel free to make a counterargument.

plumlee commented 7 years ago

Appreciate the response - I understand both of your arguments.