From 1fd5541d704edbfa79decc4db36107b9f6ec1388 Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Wed, 31 Jul 2024 10:23:27 +0200 Subject: [PATCH] [git] Fix branches study that assigns wrong branches to commits This commit fixes the Git branches study. There was a bug that didn't reset the list of commits assigned to branches, causing commits to be assigned to wrong branches. Signed-off-by: Jose Javier Merchante --- grimoire_elk/enriched/git.py | 3 ++- releases/unreleased/git-branches-study-fixed.yml | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releases/unreleased/git-branches-study-fixed.yml diff --git a/grimoire_elk/enriched/git.py b/grimoire_elk/enriched/git.py index 0c3001fd1..a85a643d6 100644 --- a/grimoire_elk/enriched/git.py +++ b/grimoire_elk/enriched/git.py @@ -1027,12 +1027,13 @@ def add_commit_branches(self, git_repo, enrich_backend): :param git_repo: GitRepository object :param enrich_backend: the enrich backend """ - to_process = [] for hash, refname in git_repo._discover_refs(remote=True): if not refname.startswith('refs/heads/'): continue + # reset the counter + to_process = [] commit_count = 0 branch_name = refname.replace('refs/heads/', '') diff --git a/releases/unreleased/git-branches-study-fixed.yml b/releases/unreleased/git-branches-study-fixed.yml new file mode 100644 index 000000000..fe25d4aaa --- /dev/null +++ b/releases/unreleased/git-branches-study-fixed.yml @@ -0,0 +1,8 @@ +--- +title: Git branches study fixed +category: fixed +author: Jose Javier Merchante +issue: null +notes: > + Git branches study was assigning branches to wrong + commits.