dk: BRANCH peut aussi être un ^COMMIT

This commit is contained in:
Jephté Clain 2020-10-28 05:54:42 +04:00
parent 85842f3c41
commit edf956f1bb
1 changed files with 16 additions and 2 deletions

18
dk
View File

@ -342,6 +342,8 @@ VARIABLES de update-apps.conf
vaut 'origin' par défaut
BRANCH
vaut 'develop' par défaut
Pour toutes les variables de type BRANCH, utiliser la syntaxe ^COMMIT
pour ignorer ORIGIN et sélectionner un commit en particulier
TYPE
vaut 'composer' par défaut si le fichier composer.json existe à la
racine du projet. sinon vaut 'none' par défaut
@ -833,14 +835,26 @@ function build_update_apps() {
setx cwd=pwd
cd "$DEST"
git fetch --all -p -f || { eend; return 1; }
git reset --hard "$ORIGIN/$BRANCH" || { eend; return 1; }
if [ "${BRANCH#^}" != "$BRANCH" ]; then
git reset --hard "${BRANCH#^}" || { cd "$cwd"; eend; return 1; }
else
git reset --hard "$ORIGIN/$BRANCH" || { cd "$cwd"; eend; return 1; }
fi
cd "$cwd"
else
# reliquat mode devel?
[ -d "$DEST" ] && rm -rf "$DEST"
# clonage initial
estep "Clonage $URL:$BRANCH --> $DEST"
git clone -o "$ORIGIN" -b "$BRANCH" "$URL" "$DEST" || { eend; return 1; }
if [ "${BRANCH#^}" != "$BRANCH" ]; then
git clone -o "$ORIGIN" "$URL" "$DEST" || { eend; return 1; }
setx cwd=pwd
cd "$DEST"
git reset --hard "${BRANCH#^}" || { cd "$cwd"; eend; return 1; }
cd "$cwd"
else
git clone -o "$ORIGIN" -b "$BRANCH" "$URL" "$DEST" || { eend; return 1; }
fi
fi
if [ -z "$TYPE" ]; then