Browse Source

implement checkoutGit()

master
belliash 9 years ago
parent
commit
fabe868bc3
1 changed files with 23 additions and 0 deletions
  1. +23
    -0
      libraries/repositories

+ 23
- 0
libraries/repositories View File

@ -3,6 +3,29 @@
# Distributed under the terms of the GNU General Public License v3
#-------------------------------------------------------------------------------
# Downloads or updates specified GIT repository
# Parameters: %dest_directory% %address% [%branch%]
#-------------------------------------------------------------------------------
function checkoutGit() {
local DIRECTORY="${1}"
local ADDRESS="${2}"
local BRANCH="${3:-master}"
if [ -d ${DIRECTORY} ]; then
cd ${DIRECTORY}
run "git reset --hard origin/${BRANCH}" || return 1
run "git clean --force" || return 1
run "git pull --no-stat" || return 1
else
run "git clone ${ADDRESS} ${DIRECTORY}" || return 1
if [ ${BRANCH} != "master" ]; then
cd ${DIRECTORY}
run "git checkout ${BRANCH}" || return 1
fi
fi
return 0
}
#-------------------------------------------------------------------------------
# Downloads or updates specified RSYNC repository
# Parameters: %dest_directory% %address%

Loading…
Cancel
Save