| 1 | #!/bin/bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | usage() { |
| 6 | echo "usage: dcp-recent REPODIR" |
| 7 | } |
| 8 | |
| 9 | rungit() { |
| 10 | ( |
| 11 | cd "$repodir" |
| 12 | git "$@" |
| 13 | ) || false |
| 14 | } |
| 15 | |
| 16 | if [ $# -lt 1 ]; then |
| 17 | usage >&2 |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | repodir="$1" |
| 22 | shift |
| 23 | |
| 24 | if [ ! -d "$repodir" ]; then |
| 25 | echo "dcp-recent: cannot find $repodir" >&2 |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
| 29 | if ! rungit tag -l | grep -q ^lastbuild$; then |
| 30 | exit 1 |
| 31 | fi |
| 32 | |
| 33 | lastbuild="$(rungit rev-parse lastbuild)" |
| 34 | master="$(rungit rev-parse master)" |
| 35 | |
| 36 | [ "$master" = "$lastbuild" ] |