From c43a8d4525b0e5a07b36d1b4b66cd18f0509ca56 Mon Sep 17 00:00:00 2001 From: iosmanthus Date: Fri, 22 Apr 2022 15:25:11 +0800 Subject: [PATCH 1/4] update all the branch of proto while precompiling to avoid commit miss Signed-off-by: iosmanthus --- dev/proto.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/proto.sh b/dev/proto.sh index 5d8dbd4b171..8d8a5b184a3 100755 --- a/dev/proto.sh +++ b/dev/proto.sh @@ -31,6 +31,7 @@ cd "$TIKV_CLIENT_HOME" || exit if [ -d "$kvproto_dir" ]; then git -C ${kvproto_dir} fetch -p + git pull --all else git clone https://github.com/pingcap/kvproto ${kvproto_dir} fi @@ -38,6 +39,7 @@ git -C ${kvproto_dir} checkout ${kvproto_hash} if [ -d "$raft_rs_dir" ]; then git -C ${raft_rs_dir} fetch -p + git pull --all else git clone https://github.com/pingcap/raft-rs ${raft_rs_dir} fi @@ -45,6 +47,7 @@ git -C ${raft_rs_dir} checkout ${raft_rs_hash} if [ -d "$tipb_dir" ]; then git -C ${tipb_dir} fetch -p + git pull --all else git clone https://github.com/pingcap/tipb ${tipb_dir} fi From 8cb44050637f04c3eb606ac8eb02247cec2e6fb8 Mon Sep 17 00:00:00 2001 From: iosmanthus Date: Sun, 24 Apr 2022 13:49:28 +0800 Subject: [PATCH 2/4] refactor proto.sh, removing redundent code Signed-off-by: iosmanthus --- dev/proto.sh | 55 +++++++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/dev/proto.sh b/dev/proto.sh index 8d8a5b184a3..419a35f4049 100755 --- a/dev/proto.sh +++ b/dev/proto.sh @@ -1,4 +1,3 @@ -#!/usr/bin/env bash # # Copyright 2017 PingCAP, Inc. # @@ -14,43 +13,29 @@ # limitations under the License. # -kvproto_hash=58f2ac94aa38f49676dd628fbcc1d669a77a62ac -raft_rs_hash=b9891b673573fad77ebcf9bbe0969cf945841926 -tipb_hash=c4d518eb1d60c21f05b028b36729e64610346dac - -kvproto_dir="kvproto" -raft_rs_dir="raft-rs" -tipb_dir="tipb" +#!/usr/bin/env bash -CURRENT_DIR=$(pwd) -TIKV_CLIENT_HOME="$( - cd "$(dirname "$0")"/.. || exit - pwd -)" -cd "$TIKV_CLIENT_HOME" || exit +proto_dir="proto" -if [ -d "$kvproto_dir" ]; then - git -C ${kvproto_dir} fetch -p - git pull --all -else - git clone https://github.com/pingcap/kvproto ${kvproto_dir} +if [ -d $proto_dir ]; then + rm -r $proto_dir fi -git -C ${kvproto_dir} checkout ${kvproto_hash} -if [ -d "$raft_rs_dir" ]; then - git -C ${raft_rs_dir} fetch -p - git pull --all -else - git clone https://github.com/pingcap/raft-rs ${raft_rs_dir} -fi -git -C ${raft_rs_dir} checkout ${raft_rs_hash} +repos=("https://github.com/pingcap/kvproto" "https://github.com/pingcap/raft-rs" "https://github.com/pingcap/tipb") +commits=(58f2ac94aa38f49676dd628fbcc1d669a77a62ac b9891b673573fad77ebcf9bbe0969cf945841926 c4d518eb1d60c21f05b028b36729e64610346dac) -if [ -d "$tipb_dir" ]; then - git -C ${tipb_dir} fetch -p - git pull --all -else - git clone https://github.com/pingcap/tipb ${tipb_dir} -fi -git -C ${tipb_dir} checkout ${tipb_hash} +for i in "${!repos[@]}"; do + repo_name=$(basename ${repos[$i]}) + git_command="git -C $repo_name" + + if [ -d "$repo_name" ]; then + $git_command checkout `basename $($git_command symbolic-ref --short refs/remotes/origin/HEAD)` + $git_command fetch --all + $git_command pull --all + else + git clone ${repos[$i]} $repo_name + $git_command fetch -p + fi -cd "$CURRENT_DIR" || exit + $git_command checkout ${commits[$i]} +done \ No newline at end of file From efdd380d666f29411cdfecf409c3601025c130d7 Mon Sep 17 00:00:00 2001 From: iosmanthus Date: Sun, 24 Apr 2022 14:05:51 +0800 Subject: [PATCH 3/4] add new line Signed-off-by: iosmanthus --- dev/proto.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/proto.sh b/dev/proto.sh index 419a35f4049..593d8749644 100755 --- a/dev/proto.sh +++ b/dev/proto.sh @@ -38,4 +38,4 @@ for i in "${!repos[@]}"; do fi $git_command checkout ${commits[$i]} -done \ No newline at end of file +done From ad4164c37e714ee8f36e9948c4f1774f49b04b25 Mon Sep 17 00:00:00 2001 From: iosmanthus Date: Sun, 24 Apr 2022 14:21:24 +0800 Subject: [PATCH 4/4] try to use bash Signed-off-by: iosmanthus --- dev/proto.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/proto.sh b/dev/proto.sh index 593d8749644..71e8c125530 100755 --- a/dev/proto.sh +++ b/dev/proto.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright 2017 PingCAP, Inc. # @@ -13,8 +14,6 @@ # limitations under the License. # -#!/usr/bin/env bash - proto_dir="proto" if [ -d $proto_dir ]; then