Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp filter skipping matches #118

Open
diegoquintanav opened this issue May 22, 2019 · 0 comments
Open

regexp filter skipping matches #118

diegoquintanav opened this issue May 22, 2019 · 0 comments

Comments

@diegoquintanav
Copy link

diegoquintanav commented May 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant