From ae98e789ed61d019e12d11d44bede006ecd3d05c Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Fri, 29 Aug 2008 02:51:07 -0500 Subject: [PATCH] Watch out for parent not existing yet. --- server/update-prefer-rebase | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/update-prefer-rebase b/server/update-prefer-rebase index 0c9126a..9ccf01c 100644 --- a/server/update-prefer-rebase +++ b/server/update-prefer-rebase @@ -56,9 +56,13 @@ git rev-parse --not --branches | git rev-list --stdin $oldrev..$newrev | while r git merge-base --all $parents | while read baserev ; do # For each parent git rev-list -n 1 --parents $commit | sed 's/ /\n/g' | grep -v $commit | while read parent ; do + parent_is_old=$(git branch --contains $parent | wc -l) all_commits=$(git rev-list --first-parent $baserev..$parent | wc -l) new_commits=$(git rev-parse --not --branches | git rev-list --stdin $baserev..$parent | wc -l) - if [[ $all_commits -eq $new_commits ]] ; then + if [ $parent_is_old -gt 0 -a $all_commits -eq $new_commits ] ; then + # echo "parent=$parent" + # echo "all_commits=$all_commits" + # echo "new_commits=$new_commits" echo "----------------------------------------------------" echo echo "It looks like you should rebase instead of merging $commit" -- 2.20.1