mirror of
https://github.com/tj/git-extras.git
synced 2026-09-15 09:56:19 -04:00
use argument separator for usages of grep which can choke on weird input
This commit is contained in:
parent
336501382e
commit
5b1ac3ccc6
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue