Merge branch 'jk/rebase-quiet-noop'
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 May 2015 21:23:49 +0000 (14:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 May 2015 21:23:49 +0000 (14:23 -0700)
"git rebase --quiet" was not quite quiet when there is nothing to
do.

* jk/rebase-quiet-noop:
rebase: silence "git checkout" for noop rebase

1  2 
git-rebase.sh
diff --combined git-rebase.sh
index fb935a03f3ababaa6359d6a7a4deafcbaa9f15c2,ba74d11941d3b714797d6a7bff6f85747b602e6a..1757404bc271ba4e1a08eb30fe27542c35e3008e
@@@ -59,7 -59,6 +59,7 @@@ If you prefer to skip this patch, run "
  To check out the original branch and stop rebasing, run "git rebase --abort".')
  "
  unset onto
 +unset restrict_revision
  cmd=
  strategy=
  strategy_opts=
@@@ -202,9 -201,9 +202,9 @@@ run_specific_rebase () 
  
  run_pre_rebase_hook () {
        if test -z "$ok_to_skip_pre_rebase" &&
 -         test -x "$GIT_DIR/hooks/pre-rebase"
 +         test -x "$(git rev-parse --git-path hooks/pre-rebase)"
        then
 -              "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
 +              "$(git rev-parse --git-path hooks/pre-rebase)" ${1+"$@"} ||
                die "$(gettext "The pre-rebase hook refused to rebase.")"
        fi
  }
@@@ -467,8 -466,8 +467,8 @@@ the
  else
        if test -z "$onto"
        then
 -              empty_tree=`git hash-object -t tree /dev/null`
 -              onto=`git commit-tree $empty_tree </dev/null`
 +              empty_tree=$(git hash-object -t tree /dev/null)
 +              onto=$(git commit-tree $empty_tree </dev/null)
                squash_onto="$onto"
        fi
        unset upstream_name
@@@ -526,10 -525,10 +526,10 @@@ case "$#" i
        ;;
  0)
        # Do not need to switch branches, we are already on it.
 -      if branch_name=`git symbolic-ref -q HEAD`
 +      if branch_name=$(git symbolic-ref -q HEAD)
        then
                head_name=$branch_name
 -              branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
 +              branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
        else
                head_name="detached HEAD"
                branch_name=HEAD ;# detached
@@@ -547,7 -546,7 +547,7 @@@ the
                        "${switch_to:-HEAD}")
        if test -n "$new_upstream"
        then
 -              upstream=$new_upstream
 +              restrict_revision=$new_upstream
        fi
  fi
  
@@@ -573,7 -572,7 +573,7 @@@ require_clean_work_tree "rebase" "$(get
  # and if this is not an interactive rebase.
  mb=$(git merge-base "$onto" "$orig_head")
  if test "$type" != interactive && test "$upstream" = "$onto" &&
 -      test "$mb" = "$onto" &&
 +      test "$mb" = "$onto" && test -z "$restrict_revision" &&
        # linear history?
        ! (git rev-list --parents "$onto".."$orig_head" | sane_grep " .* ") > /dev/null
  then
                # Lazily switch to the target branch if needed...
                test -z "$switch_to" ||
                GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" \
-                       git checkout "$switch_to" --
+                       git checkout -q "$switch_to" --
                say "$(eval_gettext "Current branch \$branch_name is up to date.")"
                finish_rebase
                exit 0
@@@ -627,7 -626,7 +627,7 @@@ if test -n "$rebase_root
  then
        revisions="$onto..$orig_head"
  else
 -      revisions="$upstream..$orig_head"
 +      revisions="${restrict_revision-$upstream}..$orig_head"
  fi
  
  run_specific_rebase