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

16
dk
View File

@ -342,6 +342,8 @@ VARIABLES de update-apps.conf
vaut 'origin' par défaut vaut 'origin' par défaut
BRANCH BRANCH
vaut 'develop' par défaut 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 TYPE
vaut 'composer' par défaut si le fichier composer.json existe à la vaut 'composer' par défaut si le fichier composer.json existe à la
racine du projet. sinon vaut 'none' par défaut racine du projet. sinon vaut 'none' par défaut
@ -833,15 +835,27 @@ function build_update_apps() {
setx cwd=pwd setx cwd=pwd
cd "$DEST" cd "$DEST"
git fetch --all -p -f || { eend; return 1; } 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" cd "$cwd"
else else
# reliquat mode devel? # reliquat mode devel?
[ -d "$DEST" ] && rm -rf "$DEST" [ -d "$DEST" ] && rm -rf "$DEST"
# clonage initial # clonage initial
estep "Clonage $URL:$BRANCH --> $DEST" estep "Clonage $URL:$BRANCH --> $DEST"
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; } git clone -o "$ORIGIN" -b "$BRANCH" "$URL" "$DEST" || { eend; return 1; }
fi fi
fi
if [ -z "$TYPE" ]; then if [ -z "$TYPE" ]; then
# possible de détecter le type quand on a le projet # possible de détecter le type quand on a le projet