summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in19
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ec28bf32..f5e6227d 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -580,9 +580,18 @@ extract_git() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git"
pushd "$srcdir" &>/dev/null
- rm -rf "${dir##*/}"
- if ! git clone "$dir"; then
+ local updating=0
+ if [[ -d "${dir##*/}" ]]; then
+ updating=1
+ cd_safe "${dir##*/}"
+ if ! git fetch; then
+ error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "git"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ cd_safe "$srcdir"
+ elif ! git clone "$dir"; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
plain "$(gettext "Aborting...")"
exit 1
@@ -590,7 +599,7 @@ extract_git() {
cd_safe "${dir##*/}"
- local ref
+ local ref=origin/HEAD
if [[ -n $fragment ]]; then
case ${fragment%%=*} in
commit|tag)
@@ -606,8 +615,8 @@ extract_git() {
esac
fi
- if [[ -n $ref ]]; then
- if ! git checkout -b makepkg $ref; then
+ if [[ $ref != "origin/HEAD" ]] || (( updating )) ; then
+ if ! git checkout --force --no-track -B makepkg $ref; then
error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
plain "$(gettext "Aborting...")"
exit 1