Skip to content

Commit 1018d4c

Browse files
committed
added simple fast forward
1 parent 429508e commit 1018d4c

1 file changed

Lines changed: 19 additions & 23 deletions

File tree

deploy

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -251,33 +251,29 @@ deploy() {
251251

252252
hook pre-deploy || abort pre-deploy hook failed
253253

254-
# fetch source
255-
log fetching updates
256-
257-
if test $fetch != "fast"; then
258-
log "full fetch"
259-
run "cd $path/source && git fetch --all --tags"
254+
if run "git rev-parse --quiet --verify $branh" > /dev/null; then
255+
log fast forward $branch
256+
run "cd $path/source && git checkout $branch && git pull origin $branch"
257+
test $? -eq 0 || abort git pull failed
260258
else
261-
log "fast fetch"
262-
run "cd $path/source && git fetch --depth=5 --all --tags"
263-
fi
259+
# fetch source
260+
log fetching updates
264261

265-
test $? -eq 0 || abort fetch failed
262+
if test $fetch != "fast"; then
263+
log "full fetch"
264+
run "cd $path/source && git fetch --all --tags"
265+
else
266+
log "fast fetch"
267+
run "cd $path/source && git fetch --depth=5 --all --tags"
268+
fi
266269

267-
# latest tag
268-
if test -z "$ref"; then
269-
log fetching latest tag
270-
ref=`run "cd $path/source && git for-each-ref refs/tags \
271-
--sort=-*authordate \
272-
--format='%(refname)' \
273-
--count=1 | cut -d '/' -f 3"`
274-
test $? -eq 0 || abort failed to determine latest tag
275-
fi
270+
test $? -eq 0 || abort fetch failed
276271

277-
# checkout ref to branch
278-
log checkout $ref to $branch
279-
run "cd $path/source && git checkout $ref -b $branch"
280-
test $? -eq 0 || abort git checkout failed
272+
# checkout ref to branch
273+
log checkout $ref to $branch
274+
run "cd $path/source && git checkout $ref -b $branch"
275+
test $? -eq 0 || abort git checkout failed
276+
fi
281277

282278
# link current
283279
run "ln -sfn $path/source $path/current"

0 commit comments

Comments
 (0)