On 10/12/13 06:31, Lukáš Jirkovský wrote:
> The local changes are discarded when updating. This matches the behaviour
> when non-VCS sources are used. It also allows incremental builds.
> 
> Signed-off-by: Lukáš Jirkovský <[email protected]>
> ---
>  scripts/makepkg.sh.in | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 1421bec..99af551 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -581,9 +581,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=false

See below.

> +     if [[ -d "${dir##*/}" ]]; then
> +             updating=true
> +             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
> @@ -591,7 +600,7 @@ extract_git() {
>  
>       cd_safe "${dir##*/}"
>  
> -     local ref
> +     local ref=origin/HEAD
>       if [[ -n $fragment ]]; then
>               case ${fragment%%=*} in
>                       commit|tag)
> @@ -607,8 +616,8 @@ extract_git() {
>               esac
>       fi
>  
> -     if [[ -n $ref ]]; then
> -             if ! git checkout -b makepkg $ref; then
> +     if [[ -n $ref ]] || ((updating)) ; then

This always updates given $ref is set to origin/HEAD above.  This should be

if [[ $ref != "origin/HEAD" ]] || (( updating )); then

and further (( updating )) always is false...  there is no such thing as
doing updating=true in bash.  Use 0/1 instead.

> +             if ! git checkout --force -B makepkg $ref; then
>                       error "$(gettext "Failure while creating working copy 
> of %s %s repo")" "${repo}" "git"
>                       plain "$(gettext "Aborting...")"
>                       exit 1
> 

I have pulled the patch to my "vcs" branch, which will be pulled when
all these are reviewed.

One down three to go!

A

Reply via email to