gitchangelog
gitchangelog copied to clipboard
regexp filter skipping matches
Hello!
Consider a tag list like this:
git tag --list
v0.7
v0.8
v1.0
v1.0.5
v1.1.0-rc1
v1.1.1-hotfix
In order to match these tags, I've modified .gitchangelog.rc
with
tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?(\-(hotfix|rc\d+))?$'
Which I tested in https://regex101.com/r/npTVQv/3
After running gitchangelog ^v0.7 HEAD
I get
%%unreleased_version%%
----------------------
New
~~~
*stuff*
v1.1.0-rc1 (2019-05-06)
-----------------------
*stuff*
Notice it's not picking v1.1.1-hotfix
. However, if I change the last regex group to (\-(hotfix))?
(removing rc\d+
from the or
), I get
%%unreleased_version%%
----------------------
New
~~~
*stuff*
v1.1.1-hotfix (2019-05-06)
--------------------------
*stuff*
The only thing that may be related is that both tags are from the same date, and gitchangelog
is aggregating them using the first (i.e. oldest) match.
This is happening before re.match
in https://github.com/vaab/gitchangelog/blob/master/src/gitchangelog/gitchangelog.py#L1551, considering
In [4]: tags
Out[4]: ['v0.7', 'v0.8', 'v1.0', 'v1.0.5', 'v1.1.0-rc1', 'v1.1.1-hotfix']
In [7]: for tag in tags:
...: if re.match(r'^v[0-9]+\.[0-9]+(\.[0-9]+)?(\-(rc\d+|hotfix))?$', tag):
...: print(tag)
...:
v0.7
v0.8
v1.0
v1.0.5
v1.1.0-rc1
v1.1.1-hotfix
I'd appreciate if you could look into this.