diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2017-07-07 09:21:18 +1000 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2017-07-07 09:21:18 +1000 |
commit | 0a1f6b2c03d27c5d123ae84a673e884c593255c9 (patch) | |
tree | bb8fbd2c0e33b44b01522f387bcbcacdae179f6c /fuzz | |
parent | 4c4f3b4dfc834144de66fc42f002268314b7598c (diff) | |
download | nss-hg-0a1f6b2c03d27c5d123ae84a673e884c593255c9.tar.gz |
Bug 1378676 - Ensure that git-copy doesn't run every time, r=franziskus
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 |