From 645fc2370ef77d15f93d7a322d22d5855b62b108 Mon Sep 17 00:00:00 2001 From: joshr Date: Sat, 18 Aug 2018 10:09:58 -0400 Subject: [PATCH] change preserve option from -C to -P --- man/man1/git-secret-hide.1.ronn | 4 ++-- man/man1/git-secret-reveal.1.ronn | 4 ++-- src/commands/git_secret_hide.sh | 8 ++++---- src/commands/git_secret_reveal.sh | 8 ++++---- tests/test_hide.bats | 4 ++-- tests/test_reveal.bats | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/man/man1/git-secret-hide.1.ronn b/man/man1/git-secret-hide.1.ronn index 86932f81..aa7c63b1 100644 --- a/man/man1/git-secret-hide.1.ronn +++ b/man/man1/git-secret-hide.1.ronn @@ -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. diff --git a/man/man1/git-secret-reveal.1.ronn b/man/man1/git-secret-reveal.1.ronn index 080ec8e9..e4b37a98 100644 --- a/man/man1/git-secret-reveal.1.ronn +++ b/man/man1/git-secret-reveal.1.ronn @@ -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. diff --git a/src/commands/git_secret_hide.sh b/src/commands/git_secret_hide.sh index d9c7078a..e7e4a376 100644 --- a/src/commands/git_secret_hide.sh +++ b/src/commands/git_secret_hide.sh @@ -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" diff --git a/src/commands/git_secret_reveal.sh b/src/commands/git_secret_reveal.sh index 1d521a2d..01d1ac29 100644 --- a/src/commands/git_secret_reveal.sh +++ b/src/commands/git_secret_reveal.sh @@ -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 diff --git a/tests/test_hide.bats b/tests/test_hide.bats index cd9e35f1..cdf7f6af 100644 --- a/tests/test_hide.bats +++ b/tests/test_hide.bats @@ -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 ] diff --git a/tests/test_reveal.bats b/tests/test_reveal.bats index 15440445..0e00d573 100644 --- a/tests/test_reveal.bats +++ b/tests/test_reveal.bats @@ -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 ]