diff options
author | Arthur She <arthur.she@linaro.org> | 2014-09-18 14:11:51 -0700 |
---|---|---|
committer | Arthur She <arthur.she@linaro.org> | 2014-09-18 14:11:51 -0700 |
commit | f44e6dfe2fc4eb65c9e9b128bd7b2aff0fa6f005 (patch) | |
tree | 0607aac21c7a2b007db6e24f54a6449bd1937319 | |
parent | 348566ec87549fb53addf1680c1f4f33d9e7e7dd (diff) |
modified: kselftest-repo-update.sh
modified: kselftest-repo.conf
-rwxr-xr-x | kselftest-repo-update.sh | 17 | ||||
-rw-r--r-- | kselftest-repo.conf | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/kselftest-repo-update.sh b/kselftest-repo-update.sh index 2cea0f1..d385a73 100755 --- a/kselftest-repo-update.sh +++ b/kselftest-repo-update.sh @@ -12,7 +12,8 @@ TCODE_DIR="${WORKING_DIR}/kselftest" checkout_branch () { # $1: branch name - + # $2: Create a new branch if it doesn't exist + ret=0 # Check if the current branch is what we want current_branch=`git branch | grep "^\*" | awk '{print $2}'` if [ "${current_branch}" = "$1" ]; then @@ -20,8 +21,14 @@ checkout_branch () { git pull else # This branch is not what we want, check out the target branch - [ -z "`git branch|grep \"$1$\"`" ] && git checkout -b $1 origin/$1 || git checkout $1 - [ $? -ne 0 ] && echo "Error: Can not checkout branch \"$1\"" && return 1 +# [ -z "`git branch|grep \"$1$\"`" ] && git checkout -b $1 origin/$1 || git checkout $1 + [ -n "`git branch|grep \"$1$\"`" ] && git checkout $1 + if [ -n "`git branch -a|grep \"origin/$1$\"`" ]; then + git checkout -b $1 origin/$1 + else + if [ "${2}" = "true" ] && git checkout -b $1 || ret=1 + fi + [ $? -ne 0 -o $ret -eq 1 ] && echo "Error: Can not checkout branch \"$1\"" && return 1 git pull fi return 0 @@ -35,7 +42,7 @@ clone_repo () { if [ -d "$3" ]; then # The source is exist, update it pushd $3 > /dev/null - checkout_branch $2 + checkout_branch $2 false [ $? -eq 0 ] && popd > /dev/null || return 1 else # We have to clone the kernel source @@ -69,7 +76,7 @@ do for b in ${bn[@]}; do echo -e "\nUpdate test code of branch \"${b}\"\n" - checkout_branch ${b} + checkout_branch ${b} true rm -rf * cp -ra ${kworking_dir}/tools/testing/selftests/* . if [ -z "`git status|grep 'nothing to commit'`" ]; then diff --git a/kselftest-repo.conf b/kselftest-repo.conf index 3cba732..68cdf5f 100644 --- a/kselftest-repo.conf +++ b/kselftest-repo.conf @@ -10,7 +10,7 @@ KSELFTEST_BRANCH=( "master linux-mainline" \ # The script will clone the branch 'BRANCH' from the repository 'GIT_REPO' REMOTE_REPO=( "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master" \ "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git master" \ - "http://git.linaro.org/kernel/linux-linaro-tracking.git master" \ + "http://git.linaro.org/kernel/linux-linaro-tracking.git linux-linaro" \ "http://git.linaro.org/kernel/linux-linaro-stable.git linux-linaro-lsk-v3.10" \ "http://git.linaro.org/kernel/linux-linaro-stable.git linux-linaro-lsk-v3.14" ) |