change preserve option from -C to -P

pull/245/head
joshr 6 years ago
parent fc9f4878a1
commit 645fc2370e

@ -3,7 +3,7 @@ git-secret-hide - encrypts all added files with the inner keyring.
## SYNOPSIS
git secret hide [-c] [-C] [-v] [-d] [-m]
git secret hide [-c] [-P] [-v] [-d] [-m]
## DESCRIPTION
@ -19,7 +19,7 @@ It is possible to modify the names of the encrypted files by setting `SECRETS_EX
-v - verbose, shows extra information.
-c - deletes encrypted files before creating new ones.
-C - sets permissions of encrypted file to match unencrypted file
-P - preserve permissions of unencrypted file in encrypted file.
-d - deletes unencrypted files after encryption.
-m - encrypt files only when modified.
-h - shows help.

@ -3,7 +3,7 @@ git-secret-reveal - decrypts all added files.
## SYNOPSIS
git secret reveal [-f] [-C] [-d dir] [-p password]
git secret reveal [-f] [-P] [-d dir] [-p password]
## DESCRIPTION
@ -18,7 +18,7 @@ Under the hood, this uses the `gpg --decrypt` command.
-f - forces to overwrite existing files without prompt.
-d - specifies `--homedir` option for the `gpg`, basically use this option if you store your keys in a custom location.
-p - specifies password for noinput mode, adds `--passphrase` option for `gpg`.
-C - set decrypted file to same permissions as encrypted file.
-P - preserve permissions of encrypted file in unencrypted file.
-h - shows help.

@ -80,18 +80,18 @@ function _optional_fsdb_update_hash {
function hide {
local clean=0
local chmod=0
local preserve=0
local delete=0
local fsdb_update_hash=0 # add checksum hashes to fsdb
local verbose=''
OPTIND=1
while getopts 'cCdmvh' opt; do
while getopts 'cPdmvh' opt; do
case "$opt" in
c) clean=1;;
C) chmod=1;;
P) preserve=1;;
d) delete=1;;
@ -164,7 +164,7 @@ function hide {
_abort "problem encrypting file with gpg: exit code $exit_code: $filename"
fi
if [[ "$chmod" == 1 ]]; then
if [[ "$preserve" == 1 ]]; then
local perms
perms=$($SECRETS_OCTAL_PERMS_COMMAND "$input_path")
chmod "$perms" "$output_path"

@ -5,17 +5,17 @@ function reveal {
local homedir=''
local passphrase=''
local force=0
local chmod=0
local preserve=0
OPTIND=1
while getopts 'hfCd:p:' opt; do
while getopts 'hfPd:p:' opt; do
case "$opt" in
h) _show_manual_for 'reveal';;
f) force=1;;
C) chmod=1;;
P) preserve=1;;
p) passphrase=$OPTARG;;
@ -49,7 +49,7 @@ function reveal {
_abort "cannot find decrypted version of file: $filename"
fi
if [[ "$chmod" == 1 ]]; then
if [[ "$preserve" == 1 ]]; then
local secret_file
secret_file=$(_get_encrypted_filename "$path")
local perms

@ -37,12 +37,12 @@ function teardown {
[ -f "$encrypted_file" ]
}
@test "run 'hide' with '-C'" {
@test "run 'hide' with '-P'" {
# attempt to alter permissions on input file
chmod o-rwx "$FILE_TO_HIDE"
run git secret hide -C
run git secret hide -P
# Command must execute normally:
[ "$status" -eq 0 ]

@ -55,7 +55,7 @@ function teardown {
}
@test "run 'reveal' with '-C'" {
@test "run 'reveal' with '-P'" {
rm "$FILE_TO_HIDE"
local password=$(test_user_password "$TEST_DEFAULT_USER")
@ -63,7 +63,7 @@ function teardown {
local secret_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
chmod o-rwx "$secret_file"
run git secret reveal -C -d "$TEST_GPG_HOMEDIR" -p "$password"
run git secret reveal -P -d "$TEST_GPG_HOMEDIR" -p "$password"
[ "$status" -eq 0 ]

Loading…
Cancel
Save