fix(fbackup): fix the crash when user have symlink need to use cp to

backup
pull/18/head
Kevin Zhuang 4 years ago
parent c7880075dd
commit cca89e4ca6

@ -7,6 +7,7 @@ Noteble changes are documentated in this file.
### Fixed
- Fixed the dotbare crash when migrating a dotfile repo with over 100 files [#12](https://github.com/kazhala/dotbare/issues/12)
- Fixed dotbare fbackup crash when using cp command on symlink
## 1.2.1 (09/07/2020)

@ -45,7 +45,9 @@ function dotbare_backup() {
while IFS= read -r line; do
dir_name=$(dirname "${line}")
[[ ! -d "${DOTBARE_BACKUP}/${dir_name}" ]] && mkdir -p "${DOTBARE_BACKUP}/${dir_name}"
command "${action_command}" "${line}" "${DOTBARE_BACKUP}/${line}"
[[ "${action_command}" == "cp" ]] \
&& "${action_command}" -a "${line}" "${DOTBARE_BACKUP}/${line}" \
|| "${action_command}" "${line}" "${DOTBARE_BACKUP}/${line}"
# Purposly didn't use the -v flag above because in finit, error message were
# directed to /dev/null but the move info will still be printed, causing confusion.
echo "${line} -> ${DOTBARE_BACKUP}/${line}"

Loading…
Cancel
Save