scripts/manage in rvm-1.0.15 vs scripts/manage in rvm-1.0.17

- old
+ new

@@ -544,11 +544,11 @@ __rvm_conditionally_add_bin_path ; export PATH builtin hash -r - if [[ -n "$(printf $rvm_ruby_version | awk '/^1\./')" \ + if [[ -n "$(printf "${rvm_ruby_version:-""}" | awk '/^1\./')" \ && ${rvm_head_flag:-0} -eq 0 ]] ; then "$rvm_path/scripts/log" "info" \ "$rvm_ruby_string #downloading ($rvm_ruby_package_file), this may take a while depending on your connection..." @@ -991,12 +991,12 @@ mkdir -p "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" "$rvm_ruby_home" unzip -o -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \ "${rvm_archives_path:-"$rvm_path/archives"}/${rvm_ruby_package_file}" >> \ - "${rvm_log_path:-"$rvm_path/log"}$rvm_ruby_string/extract.log" 2>> \ - "${rvm_log_path:-"$rvm_path/log"}$rvm_ruby_string/extract.error.log" + "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/extract.log" 2>> \ + "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/extract.error.log" result=$? if [[ "$result" -gt 1 ]] ; then "$rvm_path/scripts/log" "error" \ @@ -1350,11 +1350,11 @@ return 0 else mkdir -p "${rvm_repo_path:-"$rvm_path/repos"}" - if [[ -n "$(echo "$rvm_ruby_url" | awk '/^git/')" ]] ; then + if [[ -n "$(echo "$rvm_ruby_url" | awk '/git/')" ]] ; then if [[ -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.git" ]] ; then builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" @@ -1416,9 +1416,34 @@ \nHalting the installation." return $result fi fi fi + + if [[ -z "$rvm_ruby_repo_branch" ]]; then + rvm_ruby_repo_branch="master" + fi + + ( + remote="origin" + + cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" + + if [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]] ; then + + git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null + + elif [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]] ; then + + if ! git checkout $rvm_ruby_repo_branch 2>/dev/null ; then + + "$rvm_path/scripts/log" "error" \ + "Branch $remote/$rvm_ruby_repo_branch not found." + + fi + + fi + ) else if [[ -n "${rvm_ruby_tag:-""}" ]] ; then # TODO: Check if tag v is valid rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"