Follow renames when looking for the creation of a file

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-03-26 22:47:07 +01:00
parent 13dc634282
commit 98a53aa399

View File

@ -260,7 +260,9 @@ class EntryFileSortKey:
Return None if the file was never checked into git. Return None if the file was never checked into git.
""" """
hashes = subprocess.check_output(['git', 'log', '--format=%H', '--', filename]) hashes = subprocess.check_output(['git', 'log', '--format=%H',
'--follow',
'--', filename])
m = re.search(b'(.+)$', hashes) m = re.search(b'(.+)$', hashes)
if not m: if not m:
# The git output is empty. This means that the file was # The git output is empty. This means that the file was