Code

Merge branch 'ae/preservemerge'
authorJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:06:31 +0000 (16:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:06:31 +0000 (16:06 -0700)
* ae/preservemerge:
  rebase: Support preserving merges in non-interactive mode

1  2 
Documentation/git-rebase.txt
git-rebase.sh

Simple merge
diff --cc git-rebase.sh
index f2742aa054d2080a4a554ade3916c3bfa110af67,03e5f95051382fb1a9b811e9974cb5424fee883b..023a6dc94a48f7abf2801359ad68d40909e9b6aa
@@@ -139,23 -138,28 +139,39 @@@ finish_rb_merge () 
  }
  
  is_interactive () {
-       test -f "$dotest"/interactive ||
-       while :; do case $#,"$1" in 0,|*,-i|*,--interactive) break ;; esac
+       while test $# != 0
+       do
+               case "$1" in
+                       -i|--interactive)
+                               interactive_rebase=explicit
+                               break
+                       ;;
+                       -p|--preserve-merges)
+                               interactive_rebase=implied
+                       ;;
+               esac
                shift
-       done && test -n "$1"
+       done
+       if [ "$interactive_rebase" = implied ]; then
+               GIT_EDITOR=:
+               export GIT_EDITOR
+       fi
+       test -n "$interactive_rebase" || test -f "$dotest"/interactive
  }
  
 +run_pre_rebase_hook () {
 +      if test -z "$OK_TO_SKIP_PRE_REBASE" &&
 +         test -x "$GIT_DIR/hooks/pre-rebase"
 +      then
 +              "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
 +                      echo >&2 "The pre-rebase hook refused to rebase."
 +                      exit 1
 +              }
 +      fi
 +}
 +
  test -f "$GIT_DIR"/rebase-apply/applying &&
        die 'It looks like git-am is in progress. Cannot rebase.'