|
@ -1,12 +1,14 @@ |
|
|
vcs_git() { |
|
|
vcs_git() { |
|
|
local rev='master' |
|
|
local rev='master' |
|
|
local setver=true |
|
|
local setver=true |
|
|
|
|
|
local clone=true |
|
|
|
|
|
|
|
|
local OPTIND=1 |
|
|
local OPTIND=1 |
|
|
local opt |
|
|
local opt |
|
|
while getopts 'r:V' opt; do case "$opt" in |
|
|
while getopts 'r:VC' opt; do case "$opt" in |
|
|
r) local rev="$OPTARG" ;; |
|
|
r) local rev="$OPTARG" ;; |
|
|
V) local setver=false ;; |
|
|
V) local setver=false ;; |
|
|
|
|
|
C) local clone=false ;; |
|
|
esac; done |
|
|
esac; done |
|
|
shift $((OPTIND-1)) |
|
|
shift $((OPTIND-1)) |
|
|
[ "$1" = '--' ] && shift |
|
|
[ "$1" = '--' ] && shift |
|
@ -28,7 +30,7 @@ vcs_git() { |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# Make sure we have the latest of whatever revision we want |
|
|
# Make sure we have the latest of whatever revision we want |
|
|
git fetch --prune --depth=1 --recurse-submodules origin "$rev" || true |
|
|
git fetch --prune --depth=1 origin "$rev" || true |
|
|
|
|
|
|
|
|
# Check if it's actually been updated |
|
|
# Check if it's actually been updated |
|
|
local rev="$(git rev-parse "$rev")" |
|
|
local rev="$(git rev-parse "$rev")" |
|
@ -37,19 +39,39 @@ vcs_git() { |
|
|
vcs_compile=true |
|
|
vcs_compile=true |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Update the $version variable accordingly |
|
|
|
|
|
[ "$setver" = true ] && version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)" || true |
|
|
|
|
|
|
|
|
cd "$OLDPWD" |
|
|
cd "$OLDPWD" |
|
|
|
|
|
|
|
|
# Clone the repository |
|
|
# Clone the repository |
|
|
if [ "$download_only" = false ]; then |
|
|
if [ "$download_only" = false -a "$clone" = true ]; then |
|
|
git clone "$dir" "$reponame" 2> /dev/null |
|
|
vcs_git_clone -r "$rev" "$1" "$2" |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
cd "$reponame" |
|
|
vcs_git_clone() { |
|
|
|
|
|
local rev='master' |
|
|
|
|
|
local setver=true |
|
|
|
|
|
|
|
|
git checkout "$rev" 2> /dev/null |
|
|
local OPTIND=1 |
|
|
|
|
|
local opt |
|
|
|
|
|
while getopts 'r:' opt; do case "$opt" in |
|
|
|
|
|
r) local rev="$OPTARG" ;; |
|
|
|
|
|
esac; done |
|
|
|
|
|
shift $((OPTIND-1)) |
|
|
|
|
|
[ "$1" = '--' ] && shift |
|
|
|
|
|
|
|
|
# Update the $version variable accordingly |
|
|
local reponame="$(basename "$1")" |
|
|
[ "$setver" = true ] && version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)" || true |
|
|
local dir="$dir_source/$name/$reponame" |
|
|
|
|
|
[ "$2" ] && local dest="$2" || local dest="$reponame" |
|
|
|
|
|
mkdir -p "$dest" |
|
|
|
|
|
|
|
|
|
|
|
git clone "$dir" "$dest" 2> /dev/null |
|
|
|
|
|
|
|
|
|
|
|
cd "$dest" |
|
|
|
|
|
|
|
|
|
|
|
git checkout "$rev" 2> /dev/null |
|
|
|
|
|
|
|
|
cd "$OLDPWD" |
|
|
cd "$OLDPWD" |
|
|
fi |
|
|
|
|
|
} |
|
|
} |
|
|