Skip to content

Commit 7639e61

Browse files
fix logic for version checking in pre_commit, fix empty files always failing validate_file
1 parent 373a0b7 commit 7639e61

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

transcrypt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,15 @@ git_pre_commit() {
392392
# Get prefix of raw file in Git's index using the :FILENAME revision syntax
393393
# The first bytes of an encrypted file are always "Salted" in Base64
394394
local firstbytes=$(git show :"${secret_file}" | head -c8)
395-
if [[ $firstbytes != "U2FsdGVk" ]]; then
395+
if [[ $firstbytes == "" ]]; then
396+
: # Do nothing
397+
elif [[ $firstbytes != "U2FsdGVk" ]]; then
396398
echo "true" >>"${tmp}"
397399
fi
398400
}
399401

400-
# if bash version is 4.4 or greater than fork to number of threads otherwise run normally
401-
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]] && [[ "${BASH_VERSINFO[1]}" -ge 4 ]]; then
402+
# if bash version is greater than or equal to 4.4, fork to number of threads otherwise run normally
403+
if [[ "${BASH_VERSINFO[0]}" -gt 4 ]] || { [[ "${BASH_VERSINFO[0]}" == 4 ]] && [[ "${BASH_VERSINFO[1]}" -ge 4 ]]; }; then
402404
num_procs=$(nproc)
403405
num_jobs="\j"
404406
for secret_file in $(_list_encrypted_files); do

0 commit comments

Comments
 (0)