diff options
author | Ingy döt Net <ingy@ingy.net> | 2020-05-25 11:47:59 -0700 |
---|---|---|
committer | Ingy döt Net <ingy@ingy.net> | 2020-05-25 11:47:59 -0700 |
commit | 787f7ddf00400c30843c38c27caa083a90e2f45f (patch) | |
tree | add74afdd14c838d23350b0a0abef2440a99022d | |
parent | 6078085624593350f0cc126b48bec7e64d0f0715 (diff) | |
download | libyaml-git-787f7ddf00400c30843c38c27caa083a90e2f45f.tar.gz |
Refactor bin/pin
-rwxr-xr-x | bin/pin | 33 |
1 files changed, 24 insertions, 9 deletions
@@ -1,22 +1,37 @@ #!/bin/bash -tac conf/pin.tsv | +set -e -u -o pipefail + +debug() { + if [[ ${LIBYAML_DEBUG_PIN-} ]]; then + echo "[DEBUG] $*" >&2 + fi +} + +warn() { + echo "$*" >&2 +} + +tail -n+2 conf/pin.tsv | +tac | ( - while read -r line; do - commit_master=$(echo "$line" | cut -f1) + while read -r commit_master commit_code commit_data; do + line="$commit_master $commit_code $commit_data" + + debug "Line '$line'" + debug "Checking commit '$commit_master'" + debug "cd ../..; git merge-base --is-ancestor $commit_master HEAD" - echo "[debug] line $line" >&2 - echo "[debug] Trying commit $commit_master" >&2 - echo "[debug] cd ../..; git merge-base --is-ancestor $commit_master HEAD" >&2 - (cd ../..; git merge-base --is-ancestor "$commit_master" HEAD || echo "no" >&2) if (cd ../..; git merge-base --is-ancestor "$commit_master" HEAD 2>/dev/null); then echo "$line" exit + else + debug "Not found" fi done - echo 'WARNING: No repository pinning found for libyaml/yaml-test-suite testing.' >&2 - echo 'WARNING: Defaulting to HEAD...' >&2 + warn 'WARNING: No repository pinning found for libyaml/yaml-test-suite testing.' + warn 'WARNING: Defaulting to HEAD...' echo -e "HEAD\tHEAD\tHEAD" ) |