@@ -702,18 +702,11 @@ display_configuration() {
702
702
703
703
# remove transcrypt-related settings from the repository's git config
704
704
clean_gitconfig () {
705
- git config --remove-section transcrypt 2> /dev/null || true
706
- git config --remove-section filter.crypt 2> /dev/null || true
707
- git config --remove-section diff.crypt 2> /dev/null || true
708
- git config --remove-section merge.crypt 2> /dev/null || true
709
- git config --unset merge.renormalize
710
-
711
- # remove the merge section if it's now empty
712
- local merge_values
713
- merge_values=$( git config --get-regex --local ' merge\..*' ) || true
714
- if [[ ! $merge_values ]]; then
715
- git config --remove-section merge 2> /dev/null || true
716
- fi
705
+ git config --remove-section transcrypt" ${CONTEXT_CONFIG_GROUP} " 2> /dev/null || true
706
+
707
+ git config --remove-section filter.crypt" ${CONTEXT_CRYPT_SUFFIX} " 2> /dev/null || true
708
+ git config --remove-section diff.crypt" ${CONTEXT_CRYPT_SUFFIX} " 2> /dev/null || true
709
+ git config --remove-section merge.crypt" ${CONTEXT_CRYPT_SUFFIX} " 2> /dev/null || true
717
710
}
718
711
719
712
# Remove from the local Git DB any objects containing the cached plaintext of
@@ -776,6 +769,15 @@ flush_credentials() {
776
769
# re-encrypt any files that had been previously decrypted
777
770
force_checkout
778
771
772
+ # Unset the ls-crypt alias for the current context
773
+ # We must do this after the force checkout, which relies on ls-crypt
774
+ git config --unset alias.ls-crypt" ${CONTEXT_CRYPT_SUFFIX} " 2> /dev/null || true
775
+
776
+ # Also remove ls-crypt-default alias when removing default context
777
+ if [[ " $CONTEXT " = ' default' ]]; then
778
+ git config --unset alias.ls-crypt-default 2> /dev/null || true
779
+ fi
780
+
779
781
printf ' The local transcrypt credentials have been successfully flushed.\n'
780
782
else
781
783
die 1 ' flushing of credentials has been aborted'
@@ -864,6 +866,20 @@ uninstall_transcrypt() {
864
866
git config --remove-section alias 2> /dev/null || true
865
867
fi
866
868
869
+ # unset merge.renormalize if all transcrypt configs are now removed
870
+ local transcrypt_values
871
+ transcrypt_values=$( git config --get-regex --local ' transcrypt\..*' ) || true
872
+ if [[ ! $transcrypt_values ]]; then
873
+ git config --unset merge.renormalize
874
+ fi
875
+
876
+ # remove the merge section if it's now empty
877
+ local merge_values
878
+ merge_values=$( git config --get-regex --local ' merge\..*' ) || true
879
+ if [[ ! $merge_values ]]; then
880
+ git config --remove-section merge 2> /dev/null || true
881
+ fi
882
+
867
883
# remove any defined crypt patterns in gitattributes
868
884
case $OSTYPE in
869
885
darwin* )
0 commit comments