fix: 兼容 git version 2.11.0
This commit is contained in:
parent
6d46aaff84
commit
22dfed3209
|
|
@ -60,23 +60,33 @@
|
|||
@endstory
|
||||
|
||||
@task('clone_repository', ['on' => 'localhost'])
|
||||
echo 'Cloning repository'
|
||||
[ -d {{ $app_dir }} ] || mkdir {{ $app_dir }}
|
||||
[ -d {{ $releases_dir }} ] || mkdir {{ $releases_dir }}
|
||||
|
||||
@if($commit)
|
||||
echo '克隆分支 {{ $branch }} 提交 ID {{ $commit }} 到 {{ $new_release_dir }}'
|
||||
@if($project_dir)
|
||||
echo 'Copy repository from workspace'
|
||||
cp -r {{ $project_dir }} {{ $new_release_dir }}
|
||||
@else
|
||||
echo 'Clone branch {{ $branch }} to {{ $new_release_dir }} with all commits'
|
||||
mkdir {{ $new_release_dir }}
|
||||
cd {{ $new_release_dir }}
|
||||
git init
|
||||
git remote add origin {{ $repository }}
|
||||
git fetch --depth 1 origin {{ $commit }}
|
||||
git checkout FETCH_HEAD
|
||||
git fetch origin {{ $branch }}
|
||||
@endif
|
||||
|
||||
echo 'Checkout {{ $commit }}'
|
||||
git checkout {{ $commit }}
|
||||
@else
|
||||
echo '克隆分支 {{ $branch }} 到 {{ $new_release_dir }}'
|
||||
echo 'Clone {{ $branch }} to {{ $new_release_dir }} with 1 depth'
|
||||
git clone -b {{ $branch }} --depth 1 {{ $repository }} {{ $new_release_dir }}
|
||||
@endif
|
||||
|
||||
echo 'Remove .git directory'
|
||||
cd {{ $new_release_dir }}
|
||||
rm -rf .git
|
||||
|
||||
@endtask
|
||||
|
||||
@task('run_composer', ['on' => 'localhost'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user