fix ./scripts/env for newer git versions
authorFelix Fietkau <nbd@openwrt.org>
Tue, 2 Sep 2008 15:48:40 +0000 (15:48 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 2 Sep 2008 15:48:40 +0000 (15:48 +0000)
SVN-Revision: 12502

scripts/env

index 1aee4b3..e088695 100755 (executable)
@@ -150,7 +150,6 @@ env_delete() {
        local name="${1##*/}"
        env_init
        [ -z "$name" ] && usage
-       [ -f "$ENVDIR/.git/refs/heads/$name" ] || error "environment '$name' not found"
        branch="$(git branch | grep '^\* ' | awk '{print $2}')"
        [ "$name" = "$branch" ] && error "cannot delete the currently selected environment"
        git branch -D "$name"
@@ -159,11 +158,10 @@ env_delete() {
 env_switch() {
        local name="${1##*/}"
        [ -z "$name" ] && usage
-       [ -f "$ENVDIR/.git/refs/heads/$name" ] || error "environment '$name' not found"
 
        env_init
        env_ask_sync
-       git checkout "$name"
+       git checkout "$name" || error "environment '$name' not found"
        env_link_config
 }