diff --git a/dk b/dk index 16a400a..b8b938d 100755 --- a/dk +++ b/dk @@ -314,6 +314,21 @@ function build_update_apps() { [ -n "$branch" ] || { branch="${app}_BRANCH"; branch="${!branch}"; } [ -n "$branch" ] || branch="$DEFAULT_BRANCH" + dest="$dest/$app" + if [ ! -d "$dest" ]; then + # clonage initial + estep "Clonage $url:$branch --> $dest" + git clone -o "$origin" -b "$branch" "$url" "$dest" || { eend; return 1; } + else + # mise à jour + estep "Maj dépôt $url:$branch --> $dest" + setx cwd=pwd + cd "$dest" + git fetch --all -p -f || { eend; return 1; } + git reset --hard "$origin/$branch" || { eend; return 1; } + cd "$cwd" + fi + type="${app}_TYPE"; type="${!type}" if [ -z "$type" ]; then if [ -f "$dest/composer.json" ]; then @@ -332,21 +347,6 @@ function build_update_apps() { after_updates=() fi - dest="$dest/$app" - if [ ! -d "$dest" ]; then - # clonage initial - estep "Clonage $url:$branch --> $dest" - git clone -o "$origin" -b "$branch" "$url" "$dest" || { eend; return 1; } - else - # mise à jour - estep "Maj dépôt $url:$branch --> $dest" - setx cwd=pwd - cd "$dest" - git fetch --all -p -f || { eend; return 1; } - git reset --hard "$origin/$branch" || { eend; return 1; } - cd "$cwd" - fi - estep "Type de dépôt: $type" if [ "$type" == composer ]; then composer=/usr/bin/composer