From ded89be25969ce6dec39be76c3c315a7bb1923da Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 25 Apr 2016 21:20:56 +0400 Subject: [PATCH] pdev: corrections pour supporter nouvelle version de git --- lib/ulib/vcs | 2 +- pdev | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ulib/vcs b/lib/ulib/vcs index 82992e2..9b2c5c5 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -624,7 +624,7 @@ function git_list_rbranches() { function git_list_pbranches() { # lister les branches locales et celles qui existent dans l'origine # $1(=origin) et qui pourraient devenir une branche locale avec la commande - # git checkout + # git checkout -b local prefix="${1:-origin}/" { git for-each-ref refs/heads/ --format='%(refname:short)' diff --git a/pdev b/pdev index 14af2a1..ce87bc4 100755 --- a/pdev +++ b/pdev @@ -138,7 +138,11 @@ if [ "$action" == sync ]; then setx -a branches=list_feature_branches "$origin" for branch in "${branches[@]}"; do - git_track_branch "$branch" "$origin" + if git_have_branch "$branch"; then + git_track_branch "$branch" "$origin" + else + git branch -t "$branch" "$origin/$branch" + fi done exit $? @@ -187,7 +191,7 @@ if [ "$action" == branch ]; then if git_have_branch "$feature"; then git checkout "$feature" || r=$? elif git_have_rbranch "$feature" "$origin"; then - git checkout "$feature" || r=$? + git checkout -b "$feature" "$origin/$feature" || r=$? else estepn "\ Vous allez créer la nouvelle feature branch ${COULEUR_VERTE}$feature${COULEUR_NORMALE}