pman: tenir compte des branches distantes

This commit is contained in:
Jephté Clain 2025-03-03 06:51:49 +04:00
parent e129e0aa7f
commit 882549375c

View File

@ -97,7 +97,12 @@ function _ensure_main_branch() {
}
function checkout_main_action() {
_ensure_main_branch
if [ -z "$MainBranch" ]; then
array_contains AllBranches "$MAIN" && exit_with enote "\
$MAIN: une branche du même nom existe dans l'origine
git checkout $MAIN"
_ensure_main_branch
fi
git checkout -q "$MAIN"
}
@ -110,6 +115,9 @@ function init_develop_action() {
local -a push_branches
if [ -z "$DevelopBranch" ]; then
array_contains AllBranches "$DEVELOP" && exit_with enote "\
$DEVELOP: une branche du même nom existe dans l'origine
git checkout $DEVELOP"
_ensure_main_branch
_ensure_develop_branch
@ -136,6 +144,9 @@ function init_upstream_action() {
local -a push_branches; local config
if [ -z "$UpstreamBranch" ]; then
array_contains AllBranches "$UPSTREAM" && exit_with enote "\
$UPSTREAM: une branche du même nom existe dans l'origine
git checkout $UPSTREAM"
_ensure_develop_branch
_ensure_upstream_branch
@ -178,6 +189,9 @@ function init_dist_action() {
local -a push_branches
if [ -z "$DistBranch" ]; then
array_contains AllBranches "$DIST" && exit_with enote "\
$DIST: une branche du même nom existe dans l'origine
git checkout $DIST"
_ensure_main_branch
_ensure_dist_branch
@ -203,7 +217,10 @@ function init_feature_action() {
[ -n "$branch" ] || die "Vous devez spécifier le nom de la branche"
branch="$FEATURE$branch"
if ! array_contains AllBranches "$branch"; then
if ! array_contains LocalBranches "$branch"; then
array_contains AllBranches "$branch" && exit_with enote "\
$branch: une branche du même nom existe dans l'origine
git checkout $branch"
_ensure_develop_branch
resolve_should_push