diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-03 17:45:00 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-03 17:45:00 (GMT) |
commit | 5380d337f5d14fb70b6373fb02c3bf5f50210a13 (patch) | |
tree | 7f956018d4dceeb26e9ab90c8bafe607b157fb0f | |
parent | d5e014a3db0459e093cbef18589f8916deb5ad8a (diff) | |
download | site-5380d337f5d14fb70b6373fb02c3bf5f50210a13.tar.gz |
build-snapshot: Fix building non-"master" branches
Fix the problem that build-snapshot failed to checkout remote branches.
-rwxr-xr-x | bin/build-snapshot | 8 |
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 | |||
70 | set -x | 72 | set -x |
71 | 73 | ||
72 | src_dir="$temp_dir/src" | 74 | src_dir="$temp_dir/src" |
73 | git clone --quiet --shared "$repository" "$src_dir" | 75 | git clone --quiet --shared --no-checkout "$repository" "$src_dir" |
74 | cd "$src_dir" | 76 | cd "$src_dir" |
75 | 77 | ||
76 | for branch in $branches | 78 | for branch in $branches |
77 | do | 79 | do |
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" |
80 | done | 82 | done |
81 | 83 | ||