Closed james-hu closed 9 years ago
I hadn't considered this because in my use case the existence of at least one tag can be assumed. But you're absolutely right, treating this as an error condition is poor behavior.
The library will now use --always
internally and produce something like this when no tags exist:
{ dirty: false,
raw: '11953a8',
hash: '11953a8',
distance: null,
tag: null,
semver: null,
suffix: '11953a8',
semverString: null }
This also works with dirty repository states:
{ dirty: true,
raw: '11953a8-dirty',
hash: '11953a8',
distance: null,
tag: null,
semver: null,
suffix: '11953a8-dirty',
semverString: null }
When people use git describe in the code, normally they expect to have a string returned even if there is no tag in the repository at all. Therefore, it makes sense to add "--always" to customArguments by default.