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

Merge branch '3-copyright-hook-year-wrong' into 'master'

Copyright hook gets the last commit year wrong on some files that are not touched

Closes #3

See merge request !1
parents 27ee8c92 ac6eb46f
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')):