From 443441e9af14688bec17add676f880bd93734ddd Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 7 Apr 2010 18:08:10 -0400 Subject: [PATCH] compat-wireless: fix fallbacks for unknown branch, remote or remote URL Use bash syntax that yields the replacement value if the variable is either empty or unset. The original code would only check for unset variables, but the variable would be set even if git failed to give any output to stdout. Signed-off-by: Pavel Roskin --- scripts/admin-update.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh index 5d8068d61dfa..36cdfac3ead1 100755 --- a/scripts/admin-update.sh +++ b/scripts/admin-update.sh @@ -296,11 +296,11 @@ DIR="$PWD" cd $GIT_TREE GIT_DESCRIBE=$(git describe) GIT_BRANCH=$(git branch --no-color |sed -n 's/^\* //p') -GIT_BRANCH=${GIT_BRANCH-master} +GIT_BRANCH=${GIT_BRANCH:-master} GIT_REMOTE=$(git config branch.${GIT_BRANCH}.remote) -GIT_REMOTE=${GIT_REMOTE-origin} +GIT_REMOTE=${GIT_REMOTE:-origin} GIT_REMOTE_URL=$(git config remote.${GIT_REMOTE}.url) -GIT_REMOTE_URL=${GIT_REMOTE_URL-unknown} +GIT_REMOTE_URL=${GIT_REMOTE_URL:-unknown} echo -e "${GREEN}Updated${NORMAL} from local tree: ${BLUE}${GIT_TREE}${NORMAL}" echo -e "Origin remote URL: ${CYAN}${GIT_REMOTE_URL}${NORMAL}" cd $DIR -- 2.30.2