| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
set -euo pipefail |
| 4 |
|
| 5 |
top="$(pwd -P)" |
| 6 |
|
| 7 |
usage() { echo 'Usage: update-checkout-info DEST'; } |
| 8 |
|
| 9 |
if test "$#" -ne 1; then |
| 10 |
usage 1>&2; exit 1 |
| 11 |
fi |
| 12 |
|
| 13 |
dest="$1" |
| 14 |
|
| 15 |
if ! test -f lib/bup/bupsplit.c; then |
| 16 |
echo 'error: cannot find bup source tree' 1>&2 |
| 17 |
exit 1 |
| 18 |
fi |
| 19 |
|
| 20 |
if ! test -e .git; then |
| 21 |
# Not building from a git tree |
| 22 |
rm -f "$dest" |
| 23 |
exit 0 |
| 24 |
fi |
| 25 |
|
| 26 |
local_changes=$(git status --porcelain -uno) |
| 27 |
|
| 28 |
(git log -1 --pretty="commit='%H'%ndate='%ci'" |
| 29 |
echo -n 'modified=' |
| 30 |
if test "$local_changes"; then echo True; else echo False; fi) \ |
| 31 |
| dev/refresh -v -- "$dest" |