diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2017-08-10 15:49:32 +1000 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2017-08-10 15:49:32 +1000 |
commit | 641a9472f8bab01eb1594cdc89945a666a2b2d85 (patch) | |
tree | cba63a6df55ed96e2f29cdefbcffe8ebcb7f3c93 /fuzz | |
parent | a234c3ca2ae6fac591cc4cd9c971d21dea4544fa (diff) | |
download | nss-hg-641a9472f8bab01eb1594cdc89945a666a2b2d85.tar.gz |
Bug 1388986 - Cleanup cloned projects before updating them, r=franziskus
Diffstat (limited to 'fuzz')
-rwxr-xr-x | fuzz/config/git-copy.sh | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fuzz/config/git-copy.sh b/fuzz/config/git-copy.sh index a5c7d371d..a9e817e2a 100755 --- a/fuzz/config/git-copy.sh +++ b/fuzz/config/git-copy.sh @@ -7,18 +7,18 @@ if [ $# -lt 3 ]; then exit 2 fi -REPO=$1 -COMMIT=$2 -DIR=$3 +REPO="$1" +COMMIT="$2" +DIR="$3" 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 +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 -) + ACTUAL=$(git ls-remote "$REPO" "$COMMIT" | cut -c 1-40 -) else - ACTUAL=$COMMIT + ACTUAL="$COMMIT" fi if [ "$CURRENT" = "$ACTUAL" ]; then echo "Up to date." @@ -26,8 +26,9 @@ if [ -f $DIR/.git-copy ]; then fi fi -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 rev-parse --verify HEAD > $DIR/.git-copy -rm -rf $DIR/.git +rm -rf "$DIR" +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" rev-parse --verify HEAD > "$DIR"/.git-copy +rm -rf "$DIR"/.git |