summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-10-03 17:45:00 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-10-03 17:45:00 (GMT)
commit5380d337f5d14fb70b6373fb02c3bf5f50210a13 (patch)
tree7f956018d4dceeb26e9ab90c8bafe607b157fb0f /bin
parentd5e014a3db0459e093cbef18589f8916deb5ad8a (diff)
downloadsite-5380d337f5d14fb70b6373fb02c3bf5f50210a13.tar.gz
build-snapshot: Fix building non-"master" branches
Fix the problem that build-snapshot failed to checkout remote branches.
Diffstat (limited to 'bin')
-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