Olivia Brundage 9 months ago committed by GitHub
commit ad47ed71bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -222,6 +222,11 @@ function _get_record_filename {
local filename
filename=$(echo "$record" | awk -F: '{print $1}')
# remove / in top level file
if [[ $filename == "/"* ]]; then
filename="${filename:1}"
fi
echo "$filename"
}
@ -304,6 +309,12 @@ function _git_normalize_filename {
local result
result=$(git ls-files --full-name -o "$filename")
# if file is in the top level, append a / so only that top level file is considered
if [[ $filename != *"/"* ]]; then
result="/$result"
fi
echo "$result"
}

@ -33,7 +33,7 @@ function teardown {
local files_list
files_list=$(cat "$path_mappings")
[ "$files_list" = "$filename" ]
[ "$files_list" = "/$filename" ]
# Cleaning up:
rm "$filename" ".gitignore"
@ -70,7 +70,7 @@ function teardown {
echo "content" > "$test_file"
local quoted_name
quoted_name=$(printf '%q' "$test_file")
quoted_name=$(printf '%q' "/$test_file")
# add -i is now a no-op (See #225) so this tests that -i does nothing.
run git secret add -i "$test_file"
@ -114,7 +114,7 @@ function teardown {
[ "$status" -eq 0 ]
[[ -f "$current_dir/.gitignore" ]]
run file_has_line "$nested_dir/$test_file" "$current_dir/.gitignore"
run file_has_line "/$nested_dir/$test_file" "$current_dir/.gitignore"
[ "$output" = '0' ]
# .gitignore was not created:
@ -205,7 +205,7 @@ function teardown {
local files_list
files_list=$(cat "$path_mappings")
[ "$files_list" = "$filename" ]
[ "$files_list" = "/$filename" ]
# Cleaning up:
rm "$filename" ".gitignore"
@ -268,7 +268,7 @@ function teardown {
local files_list
files_list=$(cat "$path_mappings")
[ "$files_list" = "$filename" ]
[ "$files_list" = "/$filename" ]
# Ensuring the file is correctly git-ignored
run git check-ignore "$filename"
@ -276,4 +276,4 @@ function teardown {
# Cleaning up:
rm "$filename" ".gitignore"
}
}

@ -278,7 +278,7 @@ function teardown {
[ "$status" -eq 0 ]
# File must be removed:
[ ! -f "$FILE_TO_HIDE" ]
[ ! -f "/$FILE_TO_HIDE" ]
}
@ -287,7 +287,7 @@ function teardown {
[ "$status" -eq 0 ]
# File must be removed:
[ ! -f "$FILE_TO_HIDE" ]
[ ! -f "/$FILE_TO_HIDE" ]
# It should be verbose:
[[ "$output" == *"removing unencrypted files"* ]]
@ -311,8 +311,8 @@ function teardown {
[ "$status" -eq 0 ]
# File must be removed:
[ ! -f "$FILE_TO_HIDE" ]
[ ! -f "$second_file" ]
[ ! -f "/$FILE_TO_HIDE" ]
[ ! -f "/$second_file" ]
# It should be verbose:
[[ "$output" == *"removing unencrypted files"* ]]
@ -330,4 +330,4 @@ function teardown {
run git secret hide
[ "$status" -eq 0 ]
[[ "$output" == *"git-secret: done. 1 of 1 files are hidden."* ]]
}
}
Loading…
Cancel
Save