use argument separator for usages of grep which can choke on weird input

This commit is contained in:
Kylie McClain 2015-04-08 18:51:30 -04:00
parent 336501382e
commit 5b1ac3ccc6
6 changed files with 7 additions and 7 deletions

View file

@ -2,6 +2,6 @@
case $# in
0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;;
1) git alias | grep -e "$1" ;;
1) git alias | grep -e -- "$1" ;;
*) git config --global "alias.$1" "$2" ;;
esac

View file

@ -4,6 +4,6 @@ user="$*"
test -z "$user" && echo "user name required." 1>&2 && exit 1
count=`git log --oneline --pretty="format: %an" | grep "$user" | wc -l`
count=`git log --oneline --pretty="format: %an" | grep -- "$user" | wc -l`
test $count -eq 0 && echo "$user did not contribute." && exit 1
git shortlog | grep "$user (" -A $count
git shortlog | grep -- "$user (" -A $count

View file

@ -32,7 +32,7 @@ function add_patterns {
local file="${1/#~/$HOME}"
for pattern in "${@:2}"; do
echo "... adding '$pattern'"
(test -f "$file" && test "$pattern" && grep -q "$pattern" "$file") || echo "$pattern" >> "$file"
(test -f "$file" && test "$pattern" && grep -q -- "$pattern" "$file") || echo "$pattern" >> "$file"
done
}

View file

@ -18,7 +18,7 @@ function _test_git_scp()
function set_remote()
{
remote=$1
if [ $(git remote | grep -c ^$remote$) -eq 0 ]
if [ $(git remote | grep -c -- ^$remote$) -eq 0 ]
then
COLOR_RED
echo "Remote $remote does not exist in your git config"

View file

@ -14,7 +14,7 @@ is_commit_reference() {
is_on_current_branch() {
local commit_sha=`git rev-parse "$src"`
git rev-list HEAD |
grep -q "$commit_sha"
grep -q -- "$commit_sha"
}
commit_if_msg_provided() {

View file

@ -69,7 +69,7 @@ _git_extras(){
}
__git_extras_workflow(){
__gitcomp "$(__git_heads | grep ^$1/ | sed s/^$1\\///g) finish"
__gitcomp "$(__git_heads | grep -- ^$1/ | sed s/^$1\\///g) finish"
}
_git_feature(){