From a9e9f824fcf666cac9d543e3fcde79b2cbe286aa Mon Sep 17 00:00:00 2001 From: Michael Weichert Date: Thu, 16 Nov 2023 15:23:40 -0500 Subject: [PATCH] When deleting a note or todo, adhere to the _GIT_ENABLED env var. --- nb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/nb b/nb index 2675f9cd9..d0db3f54a 100755 --- a/nb +++ b/nb @@ -14363,27 +14363,28 @@ _delete() { then _pin unpin "${_notebook_path}/${_relative_path}" &> /dev/null || : - if [[ -d "${_notebook_path}/${_relative_path}" ]] && + if [[ -d "${_notebook_path}/${_relative_path}" ]] && [[ -z "$(ls -A "${_notebook_path}/${_relative_path}")" ]] then rm -r "${_notebook_path:?}/${_relative_path:?}" else - if git -C "${_notebook_path:?}" check-ignore \ - "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null + if [[ -z "${_GIT_ENABLED}" ]] && + git -C "${_notebook_path:?}" check-ignore "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null then rm -r "${_notebook_path:?}/${_relative_path:?}" + elif [[ -z "${_GIT_ENABLED}" ]]; then + git -C "${_notebook_path:?}" rm -r "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null else - git -C "${_notebook_path:?}" rm -r \ - "${_notebook_path:?}/${_relative_path:?}" 1>/dev/null + rm -r "${_notebook_path:?}/${_relative_path:?}" fi fi - - if [[ ! -e "${_notebook_path}/${_relative_path}" ]] + + if [[ ! -e "${_notebook_path}/${_relative_path}" ]] then _index delete "${_basename}" "${_folder_path}" - + _git checkpoint "${_notebook_path}" "[${_ME}] Delete: ${_relative_path}" - + printf "Deleted: %s\\n" "${_info_line}" fi else