summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/build-snapshot8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/build-snapshot b/bin/build-snapshot
index 651edd7..43c6293 100755
--- a/bin/build-snapshot
+++ b/bin/build-snapshot
@@ -38,7 +38,9 @@ create_snapshot()
38 branch=$1 38 branch=$1
39 snapshot_dir=$2 39 snapshot_dir=$2
40 40
41 git checkout --quiet "$branch" 41 git show-ref --verify --quiet "refs/heads/$branch" \
42 || git checkout --quiet --track "origin/$branch"
43
42 version=$(git describe --abbrev=4 'HEAD' | sed 's/release-//') 44 version=$(git describe --abbrev=4 'HEAD' | sed 's/release-//')
43 tarball="nagios-plugins-$version.tar.gz" 45 tarball="nagios-plugins-$version.tar.gz"
44 symlink="nagios-plugins-$branch.tar.gz" 46 symlink="nagios-plugins-$branch.tar.gz"
@@ -70,12 +72,12 @@ trap 'tail -n 25 "$log_file" >&3; rm -rf "$temp_dir"' EXIT
70set -x 72set -x
71 73
72src_dir="$temp_dir/src" 74src_dir="$temp_dir/src"
73git clone --quiet --shared "$repository" "$src_dir" 75git clone --quiet --shared --no-checkout "$repository" "$src_dir"
74cd "$src_dir" 76cd "$src_dir"
75 77
76for branch in $branches 78for branch in $branches
77do 79do
78 git show-ref --verify "refs/heads/$branch" \ 80 git show-ref --verify "refs/remotes/origin/$branch" \
79 && create_snapshot "$branch" "$snapshot_dir" 81 && create_snapshot "$branch" "$snapshot_dir"
80done 82done
81 83