File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1+ ## Process snippet only once
2+ <!--
3+ type: bugfix
4+ scope: all
5+ affected: all
6+ -->
7+
8+ A snippet is now only added once to the changelog, even if it has been touched or modified again at a later point in the commit history timeline.
Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ def snippets(self) -> Iterator[Tuple[Commit, Path]]:
101101 # self._logger.debug(f"collected_snippets: {collected_snippets}, looking for {self.snippets_folder}")
102102 # collected_snippets: [PosixPath('.snippets/3.md')], looking for .snippets
103103
104+ # remember which snippets have already been visited to avoid processing
105+ # it twice in case it has been touched or modified at a later point
106+ processed_snippets = []
107+
104108 # use reversed to have oldest commit as first element
105109 for idx , commit in reversed (list (enumerate (self .commits ()))):
106110 for file in commit .stats .files .keys ():
@@ -113,7 +117,8 @@ def snippets(self) -> Iterator[Tuple[Commit, Path]]:
113117 self._logger.warning(f"file {self.snippets_folder / file} is a match")
114118 yield (commit, self.snippets_folder / file)
115119 """
116- if Path (file ) in collected_snippets :
120+ if Path (file ) in collected_snippets and Path ( file ) not in processed_snippets :
117121 # self._logger.debug(f"file {file} is a match")
118122 # file .snippets/3.md is a match
123+ processed_snippets .append (Path (file ))
119124 yield (commit , Path (file ))
You can’t perform that action at this time.
0 commit comments