mirror of
https://github.com/sobolevn/git-secret
synced 2024-10-31 21:20:29 +00:00
parent
68a05aa632
commit
b0378617e2
@ -44,8 +44,10 @@ function reveal {
|
|||||||
|
|
||||||
local counter=0
|
local counter=0
|
||||||
local to_show=( "$@" )
|
local to_show=( "$@" )
|
||||||
|
local path_prepend_func='_prepend_relative_root_path'
|
||||||
|
|
||||||
if [ ${#to_show[@]} -eq 0 ]; then
|
if [ ${#to_show[@]} -eq 0 ]; then
|
||||||
|
path_prepend_func='_prepend_root_path'
|
||||||
while read -r record; do
|
while read -r record; do
|
||||||
to_show+=("$record") # add record to array
|
to_show+=("$record") # add record to array
|
||||||
done < "$path_mappings"
|
done < "$path_mappings"
|
||||||
@ -55,7 +57,7 @@ function reveal {
|
|||||||
local filename
|
local filename
|
||||||
local path
|
local path
|
||||||
filename=$(_get_record_filename "$line")
|
filename=$(_get_record_filename "$line")
|
||||||
path=$(_prepend_relative_root_path "$filename") # this uses the _relative version because of #710
|
path=$("$path_prepend_func" "$filename")
|
||||||
|
|
||||||
if [[ "$filename" == *"$SECRETS_EXTENSION" ]]; then
|
if [[ "$filename" == *"$SECRETS_EXTENSION" ]]; then
|
||||||
_abort "cannot decrypt to secret version of file: $filename"
|
_abort "cannot decrypt to secret version of file: $filename"
|
||||||
|
@ -293,3 +293,25 @@ function teardown {
|
|||||||
# clean up
|
# clean up
|
||||||
rm -rf subdir
|
rm -rf subdir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "run 'reveal' for all files from subdir" {
|
||||||
|
local password
|
||||||
|
password=$(test_user_password "$TEST_DEFAULT_USER")
|
||||||
|
|
||||||
|
mkdir -p subdir
|
||||||
|
echo "content2" > subdir/new_filename.txt
|
||||||
|
|
||||||
|
( # start subshell for subdir tests
|
||||||
|
cd subdir
|
||||||
|
run git secret add new_filename.txt
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
run git secret hide
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
run git secret reveal -d "$TEST_GPG_HOMEDIR" -p "$password"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
) # end subshell
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rm -rf subdir
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user