Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Ericsson <ae@op5.se>2008-09-30 00:28:57 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-10-01 02:34:52 +0400
commitf8cca019b9ea9471719505ca6ccf020feb219d98 (patch)
tree0d6224a8911d4a9ad10cb63689a22070e273bf1b /git-rebase.sh
parent8b745e3ffdabe6ef110dc064af46b0ba993941e0 (diff)
rebase: Support preserving merges in non-interactive mode
As a result of implementation details, 'git rebase' could previously only preserve merges in interactive mode. That limitation was hard for users to understand and awkward to explain. This patch works around it by running the interactive rebase helper git-rebase--interactive with GIT_EDITOR set to ':' when the user passes "-p" but not "-i" to the rebase command. The effect is that the interactive rebase helper is used but the user never sees an editor. The test-case included in this patch was originally written by Stephen Habermann <stephen@exigencecorp.com>, but has been extensively modified since its creation. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 528b604cd5..03e5f95051 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -138,10 +138,26 @@ 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
}
test -f "$GIT_DIR"/rebase-apply/applying &&