summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2015-02-24 19:13:36 +0000
committerTails developers <amnesia@boum.org>2015-02-24 19:27:15 +0000
commit27845603e5cb788e8298661d60efa6c88690d53c (patch)
treec84e6a17e6fc90ca07a22f8b9afbaf909f6ae51f /bin
parent44edc1d007a6b80e987a570b94240ac493c9fff2 (diff)
Make regexps a bit stricter.
Previously, e.g. any branch whose name would contain $MANAGED_REMOTE/ would be selected in some places, even if it's not on the $MANAGED_REMOTE remote.
Diffstat (limited to 'bin')
-rw-r--r--bin/git-delete-branches.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/git-delete-branches.sh b/bin/git-delete-branches.sh
index 3123c8a..fdecbf6 100644
--- a/bin/git-delete-branches.sh
+++ b/bin/git-delete-branches.sh
@@ -38,9 +38,9 @@ git fetch --prune "$MANAGED_REMOTE"
[ $REMOVE_FROM_REMOTE -eq 1 ] && \
REMOTE_BR=$(git branch -r --merged | grep -v '\->' |\
- grep -vE "\s+([^/]+)/($(generate "$BRANCHES_TO_KEEP"))$" |\
- grep -E "$MANAGED_REMOTE/")
-LOCAL_BR=$(git branch --merged | grep -Ev "\s+($(generate "$BRANCHES_TO_KEEP"))$")
+ grep -vE "^\s+([^/]+)/($(generate "$BRANCHES_TO_KEEP"))$" |\
+ grep -E "^\s+$MANAGED_REMOTE/")
+LOCAL_BR=$(git branch --merged | grep -Ev "^\s+($(generate "$BRANCHES_TO_KEEP"))$")
if [ -z "$REMOTE_BR" ] && [ -z "$LOCAL_BR" ]; then
echo "Woohoo! No unmerged branches!" >&2
@@ -61,12 +61,12 @@ else
read answer
case "$answer" in
''|y|Y|Yes|yes)
- git push $(echo $BRANCH | sed 's/\([^/]\+\)\/\(.\+\)/\1 :\2/')
+ git push $(echo $BRANCH | sed 's/^\([^/]\+\)\/\(.\+\)/\1 :\2/')
;;
esac
done
if [ -n "$LOCAL_BR" ]; then
- git branch --merged | grep -Ev "\s+($(generate "$BRANCHES_TO_KEEP"))$" | xargs -n30 git branch -d
+ git branch --merged | grep -Ev "^\s+($(generate "$BRANCHES_TO_KEEP"))$" | xargs -n30 git branch -d
fi
;;
*)