[skip ci] chore(sync): maj hooks+doc agents centralisés
This commit is contained in:
parent
7bfb2e0e7f
commit
188e281d68
@ -26,8 +26,23 @@ fi
|
||||
echo "✅ Authentification SSH réussie"
|
||||
|
||||
# Fonction pour push automatique
|
||||
get_current_branch() {
|
||||
# Détecte la branche courante, compatible anciennes versions de git
|
||||
local br
|
||||
br="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
|
||||
if [ -z "$br" ] || [ "$br" = "HEAD" ]; then
|
||||
br="$(git symbolic-ref --short -q HEAD 2>/dev/null || true)"
|
||||
fi
|
||||
if [ -z "$br" ]; then
|
||||
# dernier recours: parser la sortie de "git branch"
|
||||
br="$(git branch 2>/dev/null | sed -n 's/^* //p' | head -n1)"
|
||||
fi
|
||||
echo "$br"
|
||||
}
|
||||
|
||||
auto_push() {
|
||||
local branch=${1:-$(git branch --show-current)}
|
||||
local branch
|
||||
branch=${1:-$(get_current_branch)}
|
||||
local commit_message=${2:-"Auto-commit $(date '+%Y-%m-%d %H:%M:%S')"}
|
||||
|
||||
echo "🚀 Push automatique sur la branche: $branch"
|
||||
@ -35,7 +50,7 @@ auto_push() {
|
||||
# Ajouter tous les changements
|
||||
git add .
|
||||
|
||||
# Ne pas commiter si rien à commiter
|
||||
# Ne pas commiter si rien à commite
|
||||
if [[ -z "$(git diff --cached --name-only)" ]]; then
|
||||
echo "ℹ️ Aucun changement indexé. Skip commit/push."
|
||||
return 0
|
||||
@ -54,7 +69,7 @@ auto_push() {
|
||||
# Fonction pour push avec message personnalisé
|
||||
push_with_message() {
|
||||
local message="$1"
|
||||
local branch=${2:-$(git branch --show-current)}
|
||||
local branch=${2:-$(get_current_branch)}
|
||||
|
||||
echo "💬 Push avec message: $message"
|
||||
auto_push "$branch" "$message"
|
||||
@ -62,7 +77,7 @@ push_with_message() {
|
||||
|
||||
# Fonction pour push rapide (sans message)
|
||||
quick_push() {
|
||||
local branch=${1:-$(git branch --show-current)}
|
||||
local branch=${1:-$(get_current_branch)}
|
||||
auto_push "$branch"
|
||||
}
|
||||
|
||||
@ -149,4 +164,3 @@ case "$1" in
|
||||
esac
|
||||
|
||||
echo "🎯 Push SSH automatique terminé !"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user