summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa99c1e)
raw | patch | inline | side by side (parent: fa99c1e)
author | Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> | |
Sun, 6 Feb 2011 18:43:48 +0000 (13:43 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 10 Feb 2011 22:08:09 +0000 (14:08 -0800) |
Extract the code for am-based rebase to git-rebase--am.sh.
Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
.gitignore | patch | blob | history | |
Makefile | patch | blob | history | |
git-rebase--am.sh | [new file with mode: 0644] | patch | blob |
git-rebase.sh | patch | blob | history |
diff --git a/.gitignore b/.gitignore
index a8b98b45e374b398b75f0ff9cafd2dc10de5f9f4..7aaf5c7383bd421131d72b0371dad52176ada66e 100644 (file)
--- a/.gitignore
+++ b/.gitignore
/git-quiltimport
/git-read-tree
/git-rebase
+/git-rebase--am
/git-rebase--interactive
/git-rebase--merge
/git-receive-pack
diff --git a/Makefile b/Makefile
index 9c59e88b8d17e58e05b83eb0485f46cb322ec6c1..b2501cc03e6444b1644550eebde234494c96d781 100644 (file)
--- a/Makefile
+++ b/Makefile
SCRIPT_SH += git-mergetool.sh
SCRIPT_SH += git-pull.sh
SCRIPT_SH += git-quiltimport.sh
+SCRIPT_SH += git-rebase--am.sh
SCRIPT_SH += git-rebase--interactive.sh
SCRIPT_SH += git-rebase--merge.sh
SCRIPT_SH += git-rebase.sh
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
--- /dev/null
+++ b/git-rebase--am.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Junio C Hamano.
+#
+
+. git-sh-setup
+
+case "$action" in
+continue)
+ git am --resolved --3way --resolvemsg="$resolvemsg" &&
+ move_to_original_branch
+ exit
+ ;;
+skip)
+ git am --skip -3 --resolvemsg="$resolvemsg" &&
+ move_to_original_branch
+ exit
+ ;;
+esac
+
+test -n "$rebase_root" && root_flag=--root
+
+git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+ --src-prefix=a/ --dst-prefix=b/ \
+ --no-renames $root_flag "$revisions" |
+git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
+move_to_original_branch
+ret=$?
+test 0 != $ret -a -d "$state_dir" &&
+ echo $head_name > "$state_dir/head-name" &&
+ echo $onto > "$state_dir/onto" &&
+ echo $orig_head > "$state_dir/orig-head" &&
+ echo "$GIT_QUIET" > "$state_dir/quiet"
+exit $ret
diff --git a/git-rebase.sh b/git-rebase.sh
index 44e169fe15a8b9c2078ef050987f0fcd3e1f4a7a..c60221b5a4f4d57237af6dfc77f303107bc1491b 100755 (executable)
--- a/git-rebase.sh
+++ b/git-rebase.sh
GIT_EDITOR=:
export GIT_EDITOR
fi
- test "$type" != am && . git-rebase--$type
+ . git-rebase--$type
}
run_pre_rebase_hook () {
}
read_basic_state
run_specific_rebase
- git am --resolved --3way --resolvemsg="$resolvemsg" &&
- move_to_original_branch
- exit
;;
skip)
git reset --hard HEAD || exit $?
read_basic_state
run_specific_rebase
- git am -3 --skip --resolvemsg="$resolvemsg" &&
- move_to_original_branch
- exit
;;
abort)
git rerere clear
shift
upstream=`git rev-parse --verify "${upstream_name}^0"` ||
die "invalid upstream $upstream_name"
- unset root_flag
upstream_arg="$upstream_name"
else
test -z "$onto" && die "You must specify --onto when using --root"
unset upstream_name
unset upstream
- root_flag="--root"
- upstream_arg="$root_flag"
+ upstream_arg=--root
fi
# Make sure the branch to rebase onto is valid.
revisions="$upstream..$orig_head"
fi
-if test -z "$do_merge"
-then
- git format-patch -k --stdout --full-index --ignore-if-in-upstream \
- --src-prefix=a/ --dst-prefix=b/ \
- --no-renames $root_flag "$revisions" |
- git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
- move_to_original_branch
- ret=$?
- test 0 != $ret -a -d "$apply_dir" &&
- echo $head_name > "$apply_dir/head-name" &&
- echo $onto > "$apply_dir/onto" &&
- echo $orig_head > "$apply_dir/orig-head" &&
- echo "$GIT_QUIET" > "$apply_dir/quiet"
- exit $ret
-fi
-
-# start doing a rebase with git-merge
-# this is rename-aware if the recursive (default) strategy is used
-
run_specific_rebase