]> git.lizzy.rs Git - rust.git/blob - tests/run-make/git_clone_sha1.sh
Rollup merge of #107819 - clubby789:x-py-root, r=jyn514
[rust.git] / tests / run-make / git_clone_sha1.sh
1 #!/bin/bash -x
2
3 # Usage: $0 project_name url sha1
4 # Get the crate with the specified sha1.
5 #
6 # all arguments are required.
7 #
8 # See below link for git usage:
9 # https://stackoverflow.com/questions/3489173#14091182
10
11 # Mandatory arguments:
12 PROJECT_NAME=$1
13 URL=$2
14 SHA1=$3
15
16 function err_exit() {
17     echo "ERROR:" $*
18     exit 1
19 }
20
21 git clone $URL $PROJECT_NAME || err_exit
22 cd $PROJECT_NAME || err_exit
23 git reset --hard $SHA1 || err_exit