diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2018-08-29 16:31:56 +1000 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2018-08-29 16:31:56 +1000 |
commit | df120ea8df6b085628bd0d7566309269318ea53c (patch) | |
tree | 33c88fccf111343ef73625663ca42e0597e55977 /fuzz/config | |
parent | 5d6a9a4b2c4ac4e1245896f441ab0bcb5828ae4a (diff) | |
download | nss-hg-df120ea8df6b085628bd0d7566309269318ea53c.tar.gz |
Backed out changeset d89917892e22::d89917892e22
Diffstat (limited to 'fuzz/config')
-rwxr-xr-x | fuzz/config/git-copy.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fuzz/config/git-copy.sh b/fuzz/config/git-copy.sh index 13892bc90..a9e817e2a 100755 --- a/fuzz/config/git-copy.sh +++ b/fuzz/config/git-copy.sh @@ -12,13 +12,14 @@ COMMIT="$2" DIR="$3" echo "Copy '$COMMIT' from '$REPO' to '$DIR'" -ACTUAL=$(git ls-remote "$REPO" "$COMMIT" | cut -c 1-40 -) -if [ -z "$ACTUAL" ]; then - # Use this directly on the hope that it works. - ACTUAL="$COMMIT" -fi 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 echo "Up to date." exit @@ -27,6 +28,7 @@ fi rm -rf "$DIR" git init -q "$DIR" -git -C "$DIR" pull -q --depth=1 "$REPO" "$COMMIT" +git -C "$DIR" fetch -q --depth=1 "$REPO" "$COMMIT":git-copy-tmp +git -C "$DIR" reset --hard git-copy-tmp git -C "$DIR" rev-parse --verify HEAD > "$DIR"/.git-copy rm -rf "$DIR"/.git |