@matheusbsbs / matheus-bagliano / commits / 8f9bfb64c5
Fork 0

rebase: reorder validation steps

Reorder validation steps in preparation for the validation to be factored out from git-rebase--interactive.sh into git-rebase.sh. The main functional difference is that the pre-rebase hook will no longer be run if the work tree is dirty. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin von Zweigbergk committed Feb 6, 2011 at 13:43 UTC 8f9bfb64c5d5179cc7439715379077875248c4ab
2 files changed +7 -7
git-rebase--interactive.sh
+2 -2
@@ -792,12 +792,12 @@ else
792 test -z "$onto" &&
793 die "You must specify --onto when using --root"
794 fi
795 +require_clean_work_tree "rebase" "Please commit or stash them."
796 +
797 run_pre_rebase_hook "$upstream_arg" "$@"
798
799 comment_for_reflog start
800
799 -require_clean_work_tree "rebase" "Please commit or stash them."
800 -
801 if test ! -z "$1"
802 then
803 output git checkout "$1" -- ||
git-rebase.sh
+5 -5
@@ -433,8 +433,6 @@ fi
433
434 test "$type" = interactive && run_interactive_rebase "$@"
435
436 -require_clean_work_tree "rebase" "Please commit or stash them."
437 -
436 if test -z "$rebase_root"
437 then
438 # The upstream head must be given. Make sure it is valid.
@@ -476,9 +474,6 @@ case "$onto_name" in
474 ;;
475 esac
476
479 -# If a hook exists, give it a chance to interrupt
480 -run_pre_rebase_hook "$upstream_arg" "$@"
481 -
477 # If the branch to rebase is given, that is the branch we will rebase
478 # $branch_name -- branch being rebased, or HEAD (already detached)
479 # $orig_head -- commit object name of tip of the branch before rebasing
@@ -517,6 +512,8 @@ case "$#" in
512 esac
513 orig_head=$branch
514
515 +require_clean_work_tree "rebase" "Please commit or stash them."
516 +
517 # Now we are rebasing commits $upstream..$branch (or with --root,
518 # everything leading up to $branch) on top of $onto
519
@@ -538,6 +535,9 @@ then
535 fi
536 fi
537
538 +# If a hook exists, give it a chance to interrupt
539 +run_pre_rebase_hook "$upstream_arg" "$@"
540 +
541 # Detach HEAD and reset the tree
542 say "First, rewinding head to replay your work on top of it..."
543 git checkout -q "$onto^0" || die "could not detach HEAD"