summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-06-28 13:47:21 +0200
committertv <tv@shackspace.de>2015-06-28 13:48:48 +0200
commitf3d6721e6049525c453a5d470d27375b0173e3da (patch)
tree9dd9985d3865d40396bd55f0526efba22633f853 /bin
parent7e699c4009018d6f8cb5fe1403de4df933c6845c (diff)
fetchgit: git_rev: allow refs
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetchgit9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/fetchgit b/bin/fetchgit
index 293cc31f3..612448b3d 100755
--- a/bin/fetchgit
+++ b/bin/fetchgit
@@ -22,7 +22,7 @@ cache_dir=$cache_base/$(echo "$git_url" | urlencode)
# work_dir points to a (maybe non-existent) directory, where a specific
# revision of the repository is checked out.
-work_dir=$work_base/$(echo "$git_rev")
+work_dir=$work_base/$(echo "$git_rev" | urlencode)
cache_git() {
git --git-dir="$cache_dir" "$@"
@@ -35,7 +35,7 @@ work_git() {
is_up_to_date() {
test -d "$cache_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
@@ -52,8 +52,9 @@ if ! is_up_to_date; then
if ! test -d "$work_dir"; then
git clone -n --shared "$cache_dir" "$work_dir"
fi
- work_git checkout "$git_rev" -- "$(readlink -f "$work_dir")"
- work_git checkout -b master "$git_rev"
+ commit_name=$(cache_git rev-parse "$git_rev")
+ work_git checkout "$commit_name" -- "$(readlink -f "$work_dir")"
+ work_git checkout -q "$commit_name"
work_git submodule init
work_git submodule update
fi