From ac6eb46fee8421d217ab837f2d2204b14d6e229b Mon Sep 17 00:00:00 2001 From: Dom Sekotill Date: Mon, 2 May 2022 20:36:29 +0100 Subject: [PATCH] Fix an issue establishing last update date in copyright.py A regular expression failed to match a final line of commit log output so any file that was added in the initial commit and subsequently never updated ended up with the wrong copyright year. --- hooks/copyright.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/copyright.py b/hooks/copyright.py index 103fef9..7a20d40 100755 --- a/hooks/copyright.py +++ b/hooks/copyright.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2021 Dominik Sekotill +# Copyright 2021, 2022 Dominik Sekotill # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ def get_file_years(paths: List[Path]) -> Dict[Path, str]: cmd.extend(p.as_posix() for p in paths) proc = run(cmd, stdout=PIPE, check=True) - regex = re.compile(br'(?P[0-9]{4,})(?:\n|\r|\r\n)(?P.*?)\x00\x00') + regex = re.compile(br'(?P[0-9]{4,})(?:\n|\r|\r\n)(?P.*?)(\x00\x00|$)') for match in regex.finditer(proc.stdout): year = match.group('year').decode() for path in split_paths(match.group('files')): -- GitLab