Commit ac6eb46f authored by Dom Sekotill's avatar Dom Sekotill
Browse files

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.
parent 6d0f3cdc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
#!/usr/bin/env python3
#  Copyright 2021  Dominik Sekotill <dom.sekotill@kodo.org.uk>
#  Copyright 2021, 2022  Dominik Sekotill <dom.sekotill@kodo.org.uk>
#
#  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<year>[0-9]{4,})(?:\n|\r|\r\n)(?P<files>.*?)\x00\x00')
	regex = re.compile(br'(?P<year>[0-9]{4,})(?:\n|\r|\r\n)(?P<files>.*?)(\x00\x00|$)')
	for match in regex.finditer(proc.stdout):
		year = match.group('year').decode()
		for path in split_paths(match.group('files')):