index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Lukáš Jirkovský <l.jirkovsky@gmail.com> | 2013-12-09 21:31:23 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-11-09 16:09:27 +1000 |
commit | f6b3c9d8038085a9b8ac2151a0ca3dafd637d3e2 (patch) | |
tree | 4c8ca3e10a36dab11a6a15b5751b5f10a45177d7 | |
parent | ecf0e37fc5b583c3694e6847e9f38edb8bae413a (diff) |
-rw-r--r-- | scripts/makepkg.sh.in | 19 |
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 |