Skip to content

Commit 9a8a1f4

Browse files
andreineculauelasticdog
authored andcommitted
silence "fatal: no such section: <name>" messages
stemming from `git config --remove-section` commands git 2.18+ (Q2 2018) will remove empty sections on its own as per https://stackoverflow.com/a/50274206/465684
1 parent 9ee68cf commit 9a8a1f4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

transcrypt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,15 @@ display_configuration() {
373373

374374
# remove transcrypt-related settings from the repository's git config
375375
clean_gitconfig() {
376-
git config --remove-section transcrypt
377-
git config --remove-section filter.crypt
378-
git config --remove-section diff.crypt
376+
git config --remove-section transcrypt 2> /dev/null
377+
git config --remove-section filter.crypt 2> /dev/null
378+
git config --remove-section diff.crypt 2> /dev/null
379379
git config --unset merge.renormalize
380380

381381
# remove the merge section if it's now empty
382382
local merge_values=$(git config --get-regex --local 'merge\..*')
383383
if [[ ! $merge_values ]]; then
384-
git config --remove-section merge
384+
git config --remove-section merge 2> /dev/null
385385
fi
386386
}
387387

@@ -471,7 +471,7 @@ uninstall_transcrypt() {
471471
# remove the alias section if it's now empty
472472
local alias_values=$(git config --get-regex --local 'alias\..*')
473473
if [[ ! $alias_values ]]; then
474-
git config --remove-section alias
474+
git config --remove-section alias 2> /dev/null
475475
fi
476476

477477
# remove any defined crypt patterns in gitattributes

0 commit comments

Comments
 (0)