Merge branch 'ph/rebase-original'
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Apr 2013 22:28:34 +0000 (15:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Apr 2013 22:28:34 +0000 (15:28 -0700)
* ph/rebase-original:
rebase: find orig_head unambiguously

1  2 
git-rebase.sh
t/t3400-rebase.sh
diff --combined git-rebase.sh
index b2f1c76dc3ede707870564a8ba73af6d1753e95c,d6c52e6f9041bed6bbd575f51e604cada7dfb842..2c692c33e95c4f75a5524a76a8136841cb2e4a57
@@@ -8,7 -8,7 +8,7 @@@ OPTIONS_KEEPDASHDASH
  OPTIONS_SPEC="\
  git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]
  git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]
 -git-rebase [-i] --continue | --abort | --skip
 +git-rebase --continue | --abort | --skip | --edit-todo
  --
   Available options are
  v,verbose!         display a diffstat of what changed upstream
@@@ -38,7 -38,6 +38,7 @@@ C=!                passed to 'git apply
  continue!          continue
  abort!             abort and check out the original branch
  skip!              skip current patch and continue
 +edit-todo!         edit the todo list during an interactive rebase
  "
  . git-sh-setup
  . git-sh-i18n
@@@ -191,7 -190,7 +191,7 @@@ d
        --verify)
                ok_to_skip_pre_rebase=
                ;;
 -      --continue|--skip|--abort)
 +      --continue|--skip|--abort|--edit-todo)
                test $total_argc -eq 2 || usage
                action=${1##--}
                ;;
@@@ -307,11 -306,6 +307,11 @@@ the
        fi
  fi
  
 +if test "$action" = "edit-todo" && test "$type" != "interactive"
 +then
 +      die "$(gettext "The --edit-todo action can only be used during interactive rebase.")"
 +fi
 +
  case "$action" in
  continue)
        # Sanity check
@@@ -344,9 -338,6 +344,9 @@@ abort
        rm -r "$state_dir"
        exit
        ;;
 +edit-todo)
 +      run_specific_rebase
 +      ;;
  esac
  
  # Make sure no rebase is in progress
@@@ -473,7 -464,7 +473,7 @@@ case "$#" i
                head_name="detached HEAD"
                branch_name=HEAD ;# detached
        fi
-       orig_head=$(git rev-parse --verify "${branch_name}^0") || exit
+       orig_head=$(git rev-parse --verify HEAD) || exit
        ;;
  *)
        die "BUG: unexpected number of arguments left to parse"
diff --combined t/t3400-rebase.sh
index f6cc10265700730999174347704a0df6989c7f1b,e6af021c10b61f565e1ebc5b0a974eb949737e07..b58fa1a23243e435f119afb9966b0a80cbc1e4d4
@@@ -101,7 -101,14 +101,14 @@@ test_expect_success 'HEAD was detached 
        test $(git rev-parse HEAD@{1}) != $(git rev-parse my-topic-branch@{1})
  '
  
+ test_expect_success 'rebase from ambiguous branch name' '
+       git checkout -b topic side &&
+       git rebase master
+ '
  test_expect_success 'rebase after merge master' '
+       git checkout --detach refs/tags/topic &&
+       git branch -D topic &&
        git reset --hard topic &&
        git merge master &&
        git rebase master &&
@@@ -138,7 -145,8 +145,7 @@@ test_expect_success 'rebase a single mo
  '
  
  test_expect_success 'rebase is not broken by diff.renames' '
 -      git config diff.renames copies &&
 -      test_when_finished "git config --unset diff.renames" &&
 +      test_config diff.renames copies &&
        git checkout filemove &&
        GIT_TRACE=1 git rebase force-3way
  '