cmake: make sure sha1 is computed without filters

Local filters in ~/gitconfig, such as

[core]
	autocrlf = input

can impact the result of git hash-object. Make sure no filters are
used so that the hash value remains unmodified across user setups.

BugLink: https://github.com/thesofproject/sof/issues/5917
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This commit is contained in:
Pierre-Louis Bossart 2022-06-14 17:04:02 -05:00 committed by Liam Girdwood
parent 015ec63c4d
commit 3315681c69
1 changed files with 2 additions and 2 deletions

View File

@ -114,13 +114,13 @@ if(EXISTS ${SOF_ROOT_SOURCE_DIRECTORY}/.git/)
OUTPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_list" OUTPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_list"
) )
# calculate hash of each listed files (from file version saved in file system) # calculate hash of each listed files (from file version saved in file system)
execute_process(COMMAND git hash-object --stdin-paths execute_process(COMMAND git hash-object --no-filters --stdin-paths
WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY} WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY}
INPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_list" INPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_list"
OUTPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_hash_list" OUTPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_hash_list"
) )
# then calculate single hash of previously calculated hash list # then calculate single hash of previously calculated hash list
execute_process(COMMAND git hash-object --stdin execute_process(COMMAND git hash-object --no-filters --stdin
WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY} WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY}
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
INPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_hash_list" INPUT_FILE "${SOURCE_HASH_DIR}/tracked_file_hash_list"