X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=dev%2Fupdate-checkout-info;fp=dev%2Fupdate-checkout-info;h=9a54344972e138d92b83fb6fe5c66f8f11da4b16;hb=073f1e521cdfc39d302eaeac49745b1f1a25a1c0;hp=0000000000000000000000000000000000000000;hpb=dd5351bd3ca731fa5caada713ce522af84edef58;p=bup.git diff --git a/dev/update-checkout-info b/dev/update-checkout-info new file mode 100755 index 0000000..9a54344 --- /dev/null +++ b/dev/update-checkout-info @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -euo pipefail + +top="$(pwd)" + +usage() { echo 'Usage: update-checkout-info DEST'; } + +if test "$#" -ne 1; then + usage 1>&2; exit 1 +fi + +dest="$1" + +if ! test -f lib/bup/bupsplit.c; then + echo 'error: cannot find bup source tree' 1>&2 + exit 1 +fi + +git_top=$(git rev-parse --show-toplevel) || true +if test "$git_top" != "$top"; then + # Not a checkout, or perhaps we're building from an archive dir + # unpacked somewhere in the source tree. + rm -f "$dest" + exit 0 +fi + +local_changes=$(git status --porcelain -uno) + +(git log -1 --pretty="commit='%H'%ndate='%ci'" + echo -n 'modified=' + if test "$local_changes"; then echo True; else echo False; fi) \ + | dev/refresh -v -- "$dest"