From 6a6222c9f5cda26f690796b60ea9ab7a549380d6 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 24 Jul 2008 01:13:23 -0500 Subject: [PATCH] Handle multiple base revisions--now with the code. --- server/update-prefer-rebase | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/server/update-prefer-rebase b/server/update-prefer-rebase index 97e8a01..318536b 100644 --- a/server/update-prefer-rebase +++ b/server/update-prefer-rebase @@ -52,18 +52,23 @@ git rev-parse --not --branches | git rev-list --stdin $oldrev..$newrev | while r # Find the original branch point (B) parents=$(git rev-list -n 1 --parents $commit | sed 's/ /\n/g' | grep -v $commit) - baserev=$(git merge-base $parents) - # For each parent - git rev-list -n 1 --parents $commit | sed 's/ /\n/g' | grep -v $commit | while read parent ; do - 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 - echo "----------------------------------------------------" - echo - echo "It looks like you should rebase instead of merging $commit" - echo - echo "----------------------------------------------------" + # For each baserev + 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 + 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 + echo "----------------------------------------------------" + echo + echo "It looks like you should rebase instead of merging $commit" + echo + echo "----------------------------------------------------" + exit 1 + fi + done + if [ $? -ne 0 ] ; then exit 1 fi done -- 2.39.5