g push/status: use @{upstream} instead of origin

origin won't work if origin/HEAD points to nowhere, which is a valid
use-case.
This commit is contained in:
Miklos Vajna
2012-03-13 11:48:37 +01:00
parent 1613a4949f
commit ae6d4aeb89

4
g
View File

@@ -321,11 +321,11 @@ for REPO in $DIRS ; do
;; ;;
push) push)
if [ "$PUSH_ALL" != "1" ] ; then if [ "$PUSH_ALL" != "1" ] ; then
[ -n "$(git rev-list origin..HEAD)" ] || exit 0 [ -n "$(git rev-list @{upstream}..HEAD)" ] || exit 0
fi fi
;; ;;
status) status)
LOCALCOMMITS="$(git rev-list origin..HEAD)" LOCALCOMMITS="$(git rev-list @{upstream}..HEAD)"
if [ -z "$LOCALCOMMITS" ] ; then if [ -z "$LOCALCOMMITS" ] ; then
[ -z "$(git diff-index --name-only HEAD --)" ] && exit 0 [ -z "$(git diff-index --name-only HEAD --)" ] && exit 0
fi fi