mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复拉取仓库逻辑
This commit is contained in:
parent
618756d4a9
commit
8b7bef097c
|
@ -322,11 +322,14 @@ git_pull_scripts() {
|
||||||
echo -e "开始更新仓库:$dir_work"
|
echo -e "开始更新仓库:$dir_work"
|
||||||
set_proxy "$proxy"
|
set_proxy "$proxy"
|
||||||
|
|
||||||
|
if [[ ! $branch ]]; then
|
||||||
|
branch=$(cd $dir_work && git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
|
||||||
|
fi
|
||||||
|
|
||||||
local pre_commit_id=$(git rev-parse --short HEAD)
|
local pre_commit_id=$(git rev-parse --short HEAD)
|
||||||
reset_branch "$branch" "$dir_work"
|
reset_branch "$branch" "$dir_work"
|
||||||
|
|
||||||
git fetch --depth=1 --all
|
git fetch --depth 1 origin $branch
|
||||||
git pull --depth=1 --allow-unrelated-histories &>/dev/null
|
|
||||||
exit_status=$?
|
exit_status=$?
|
||||||
|
|
||||||
reset_branch "$branch" "$dir_work"
|
reset_branch "$branch" "$dir_work"
|
||||||
|
@ -359,14 +362,10 @@ reset_romote_url() {
|
||||||
|
|
||||||
reset_branch() {
|
reset_branch() {
|
||||||
local branch="$1"
|
local branch="$1"
|
||||||
local dir="$2"
|
|
||||||
if [[ ! $branch ]]; then
|
|
||||||
branch=$(cd $dir && git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
|
|
||||||
fi
|
|
||||||
local part_cmd="origin/${branch}"
|
local part_cmd="origin/${branch}"
|
||||||
git remote set-branches --add origin $branch &>/dev/null
|
git remote set-branches origin $branch
|
||||||
git reset --hard $part_cmd &>/dev/null
|
git reset --hard $part_cmd &>/dev/null
|
||||||
git checkout --track $part_cmd &>/dev/null
|
git checkout -b $branch $part_cmd &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
random_range() {
|
random_range() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user