summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-06-28 13:47:21 +0200
committertv <tv@krebsco.de>2015-06-28 13:48:48 +0200
commitaa315bce60f8d5fdee792c9c7b42f35b6bc44981 (patch)
tree9dd9985d3865d40396bd55f0526efba22633f853
parent3419c6399f842bfb65ab885372e30e786c55c620 (diff)
fetchgit: git_rev: allow refs
-rwxr-xr-xbin/fetchgit9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/fetchgit b/bin/fetchgit
index 293cc31..612448b 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