sp1thas/dropboxignore

`dropboxignore update` broken

Closed this issue · 0 comments

Describe the bug
dropboxignore update overwrite to .gitignore instead append to .dropboxignore

To Reproduce
Steps to reproduce the behavior:

  1. Create folder with .gitignore
  2. The content of .gitignore( if applicable)
bin/

and .dropboxignore files is

bin/
  1. change .gitignore to
bin/
foo/
  1. run dropboxignore update

Expected behavior
.dropboxignore change to

bin/
foo/

Actual behavior
.gitignore change to

foo/

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Version: latest master

Additional context
The problem should be here

update_dropboxignore_file() {
  diff_content=$(diff --new-line-format="" --unchanged-line-format="" --ignore-blank-lines --ignore-tab-expansion --ignore-space-change --ignore-trailing-space -I "# [Automatically|-]" "${1}" "${2}")
  if [ -n "$diff_content" ]; then
    tee "$1" >/dev/null <<EOF
# Automatically updated .dropboxignore file at "$(date)"
# ----
$diff_content
# ----
EOF
    echo -e "$GREEN Updated $(get_relative_path "$2" "$BASE_FOLDER") $DEFAULT"
  else
    log_debug "No changes found: $(get_relative_path "$2" "$BASE_FOLDER")"
  fi
}

should change to

...
tee -a "$2" >/dev/null <<EOF
...