summaryrefslogtreecommitdiff
path: root/worker/scripts/fetch_code
blob: cc2d56155f73896129b4519dc3c3c6eb57b0a175 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

export LOG_PREFIX="[fetch_code $remote @ $checkout -> $path]"

log "getting the codez~ time to fetch!"
git clone "$remote" "$path"
if [ ! $? -eq 0 ]; then
  log "D: oh nyo! couldn't clone the repo"
  exit 1
fi

cd "$path"
log "switching to $checkout~"
git reset --hard "$checkout"
if [ ! $? -eq 0 ]; then
  log "D: can't reset to $checkout"
  cd -
  exit 1
fi

cd -