diff options
Diffstat (limited to 'fuzz')
-rwxr-xr-x | fuzz/config/git-copy.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fuzz/config/git-copy.sh b/fuzz/config/git-copy.sh index 1389ddabd..a5c7d371d 100755 --- a/fuzz/config/git-copy.sh +++ b/fuzz/config/git-copy.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -e @@ -15,18 +15,19 @@ echo "Copy '$COMMIT' from '$REPO' to '$DIR'" if [ -f $DIR/.git-copy ]; then CURRENT=$(cat $DIR/.git-copy) if [ $(echo -n $COMMIT | wc -c) != "40" ]; then + # On the off chance that $COMMIT is a remote head. ACTUAL=$(git ls-remote $REPO $COMMIT | cut -c 1-40 -) else ACTUAL=$COMMIT fi - if [ CURRENT = ACTUAL ]; then + if [ "$CURRENT" = "$ACTUAL" ]; then echo "Up to date." + exit fi fi -mkdir -p $DIR -git -C $DIR init -q +git init -q $DIR git -C $DIR fetch -q --depth=1 $REPO $COMMIT:git-copy-tmp git -C $DIR reset --hard git-copy-tmp -git -C $DIR show-ref HEAD | cut -c 1-40 - > $DIR/.git-copy +git -C $DIR rev-parse --verify HEAD > $DIR/.git-copy rm -rf $DIR/.git |