fetchgit: git_rev: allow refs
This commit is contained in:
parent
7e699c4009
commit
f3d6721e60
@ -22,7 +22,7 @@ cache_dir=$cache_base/$(echo "$git_url" | urlencode)
|
|||||||
|
|
||||||
# work_dir points to a (maybe non-existent) directory, where a specific
|
# work_dir points to a (maybe non-existent) directory, where a specific
|
||||||
# revision of the repository is checked out.
|
# revision of the repository is checked out.
|
||||||
work_dir=$work_base/$(echo "$git_rev")
|
work_dir=$work_base/$(echo "$git_rev" | urlencode)
|
||||||
|
|
||||||
cache_git() {
|
cache_git() {
|
||||||
git --git-dir="$cache_dir" "$@"
|
git --git-dir="$cache_dir" "$@"
|
||||||
@ -35,7 +35,7 @@ work_git() {
|
|||||||
is_up_to_date() {
|
is_up_to_date() {
|
||||||
test -d "$cache_dir" &&
|
test -d "$cache_dir" &&
|
||||||
test -d "$work_dir" &&
|
test -d "$work_dir" &&
|
||||||
test "$(work_git rev-parse HEAD)" = "$git_rev"
|
test "$(work_git rev-parse HEAD)" = "$(cache_git rev-parse "$git_rev")"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! is_up_to_date; then
|
if ! is_up_to_date; then
|
||||||
@ -52,8 +52,9 @@ if ! is_up_to_date; then
|
|||||||
if ! test -d "$work_dir"; then
|
if ! test -d "$work_dir"; then
|
||||||
git clone -n --shared "$cache_dir" "$work_dir"
|
git clone -n --shared "$cache_dir" "$work_dir"
|
||||||
fi
|
fi
|
||||||
work_git checkout "$git_rev" -- "$(readlink -f "$work_dir")"
|
commit_name=$(cache_git rev-parse "$git_rev")
|
||||||
work_git checkout -b master "$git_rev"
|
work_git checkout "$commit_name" -- "$(readlink -f "$work_dir")"
|
||||||
|
work_git checkout -q "$commit_name"
|
||||||
work_git submodule init
|
work_git submodule init
|
||||||
work_git submodule update
|
work_git submodule update
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user