For git, add plaintext files to .gitignore to prevent accidental additions.

This commit is contained in:
tlimoncelli@stackexchange.com
2014-10-14 14:23:34 +00:00
parent 574bbf50ad
commit 225909cdf3
2 changed files with 46 additions and 12 deletions

View File

@@ -49,10 +49,12 @@ fi
IGNOREFILE=".${VCS_TYPE}ignore"
if [[ $VCS_TYPE = 'git' ]]; then
if ! grep -Fsx >/dev/null "$unencrypted_file" "$IGNOREFILE"; then
echo "$unencrypted_file" >>"$IGNOREFILE"
COMMIT_FILES="$COMMIT_FILES $IGNOREFILE"
fi
ignored_file="$(echo "$unencrypted_file" | sed 's/^\([!#]\)/\\\1/')"
if ! grep -Fsx >/dev/null "$ignored_file" "$IGNOREFILE"; then
echo "$ignored_file" >>"$IGNOREFILE"
COMMIT_FILES="$COMMIT_FILES $IGNOREFILE"
fi
vcs_add "$IGNOREFILE"
fi
echo 'NOTE: "already tracked!" messages are safe to ignore.'