From f3d6721e6049525c453a5d470d27375b0173e3da Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Jun 2015 13:47:21 +0200 Subject: fetchgit: git_rev: allow refs --- bin/fetchgit | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/fetchgit b/bin/fetchgit index 293cc31f..612448b3 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 -- cgit v1.2.3