Skip to content

Commit

Permalink
fix remote branch detection where a checkin occurred on release/maste…
Browse files Browse the repository at this point in the history
…r instead of on a feature branch
  • Loading branch information
handcraftsman committed Feb 20, 2012
1 parent df7a9ec commit c75312f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions scripts/hack.sh
Expand Up @@ -8,10 +8,14 @@ for branch in ${remoteBranches}
do
if [ "${CURRENT}" == "$(git branch --contains ${branch} | grep '\*' | awk '{print $2}')" ]
then
currentBranches="$(git branch --contains ${branch} | grep -v '\*' | awk '{print $1}')"
remote="$(echo ${remoteBranches} ${currentBranches} | tr ' ' '\n' | sort | uniq -c | grep "2" | awk '{print $2}' | head -1)"
remote=$branch
fi
done
if [ "" == "${remote}" ]
then
currentBranches="$(git branch --contains ${CURRENT} | grep -v '\*' | awk '{print $1}')"
remote="$(echo ${remoteBranches} ${currentBranches} | tr ' ' '\n' | sort | uniq -c | grep "2" | awk '{print $2}' | head -1)"
fi
echo "remote branch is: ${remote}"
if [ "${CURRENT}" == "${remote}" -o "" == "${remote}" ]
then
Expand Down
10 changes: 7 additions & 3 deletions scripts/ship.sh
Expand Up @@ -2,15 +2,19 @@
# Git workflow ship script
CURRENT="$(git branch | grep '\*' | awk '{print $2}')"
echo "current branch is: ${CURRENT}"
remoteBranches="$(git branch -r | tr '/' ' ' | awk '{print $2}')"
remoteBranches="$(git branch -r | grep -v 'HEAD' | tr '/' ' ' | awk '{print $2}')"
for branch in ${remoteBranches}
do
if [ "${CURRENT}" == "$(git branch --contains ${branch} | grep '\*' | awk '{print $2}')" ]
then
currentBranches="$(git branch --contains ${branch} | grep -v '\*' | awk '{print $1}')"
remote="$(echo ${remoteBranches} ${currentBranches} | tr ' ' '\n' | sort | uniq -c | grep "2" | awk '{print $2}' | head -1)"
remote=$branch
fi
done
if [ "" == "${remote}" ]
then
currentBranches="$(git branch --contains ${CURRENT} | grep -v '\*' | awk '{print $1}')"
remote="$(echo ${remoteBranches} ${currentBranches} | tr ' ' '\n' | sort | uniq -c | grep "2" | awk '{print $2}' | head -1)"
fi
echo "remote branch is: ${remote}"
if [ "${CURRENT}" == "${remote}" -o "" == "${remote}" ]
then
Expand Down

0 comments on commit c75312f

Please sign in to comment.