Permalink
Browse files

Avoid spurious newlines

  • Loading branch information...
1 parent a0c4cb3 commit 73c2ad0393070438fb9e2aa3aa7c8a3faee55f43 @lennartcl committed Oct 15, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 git-out
View
11 git-out
@@ -54,42 +54,42 @@ if [ ! $NO_FETCH ]; then
FETCHER=$!
fi
-DID_PRIVATES=
+PRINTED_FIRST=
for BRANCH in $BRANCHES; do
if echo $BRANCH | grep '^_' >/dev/null || [ "$BRANCH" == "(no" ] ||
[ "$BRANCH" == "branch)" ]; then
continue
fi
if ! git show --oneline origin/$BRANCH &> /dev/null; then
LOG=`git log --oneline --first-parent $BRANCH --not --remotes=origin`
+ [ $PRINTED_FIRST ] && echo || PRINTED_FIRST=1
if [ "$LOG" == "" ]; then
echo -e "\033[09;32m$BRANCH\033[00m (empty)"
- echo
else
echo -e "\033[01;32m$BRANCH\033[00m (not in upstream)"
if [ $QUIET ]; then
echo "`echo "$LOG" | wc -l` commit(s)"
else
echo "$LOG"
fi
- echo
fi
elif [ "`git log origin/$BRANCH..$BRANCH 2>/dev/null`" != "" ]; then
+ [ $PRINTED_FIRST ] && echo || PRINTED_FIRST=1
LOG=`git log --oneline --first-parent $BRANCH --not --remotes=origin`
echo -e "\033[01;32m$BRANCH\033[00m"
if [ $QUIET ]; then
echo "`echo "$LOG" | wc -l` commit(s)"
else
echo "$LOG"
fi
- echo
elif [ "`git log origin/master..$BRANCH 2>/dev/null`" != "" ]; then
FETCHERS="$FETCHERS $BRANCH"
fi
done
if [ "$FETCHERS" != "" ]; then
if [ ! $NO_FETCH ]; then
+ [ $PRINTED_FIRST ] && echo || PRINTED_FIRST=1
if which git-list-pull-requests &>/dev/null; then
git list-pull-requests -a >/tmp/.git-out-requests &
PULLS=$!
@@ -103,20 +103,21 @@ if [ "$FETCHERS" != "" ]; then
clearLine
FETCHED=1
fi
+ PRINTED_FIRST=
for BRANCH in $FETCHERS; do
if [ "`git log origin/master..$BRANCH 2>/dev/null`" != "" ]; then
if [ ! $NO_FETCH ]; then
wait $PULLS
PULL_REQUESTS=`cat /tmp/.git-out-requests`
fi
if [ "`git log origin/master..$BRANCH 2>/dev/null`" != "" ]; then
+ [ $PRINTED_FIRST ] && echo || PRINTED_FIRST=1
if [ ! $NO_FETCH ] && echo "$PULL_REQUESTS" | grep "^$BRANCH\$" > /dev/null; then
echo -e "$BRANCH (in pull request)"
git is-current -f -q $BRANCH
else
echo -e "\033[01;32m$BRANCH\033[00m (in upstream, not in master or beta)"
fi
- echo
fi
fi
done

0 comments on commit 73c2ad0

Please sign in to comment.