Better handle filenames with * and ? in them.

This commit is contained in:
tlimoncelli@stackexchange.com
2014-10-14 14:43:03 +00:00
parent e12de7dfe3
commit d1a9dbcd2e
2 changed files with 8 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ fi
# VCS-independent way.
IGNOREFILE=".${VCS_TYPE}ignore"
if [[ $VCS_TYPE = 'git' ]]; then
ignored_file="$(echo "$unencrypted_file" | sed 's/^\([!#]\)/\\\1/')"
ignored_file="$(echo "$unencrypted_file" | sed 's/\([\*\?]\)/\\\1/g' | sed 's/^\([!#]\)/\\\1/')"
if ! grep -Fsx >/dev/null "$ignored_file" "$IGNOREFILE"; then
echo "$ignored_file" >>"$IGNOREFILE"
COMMIT_FILES="$COMMIT_FILES $IGNOREFILE"