summaryrefslogtreecommitdiff
path: root/git-rebase--am.sh
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>2011-02-06 13:43:48 -0500
committerJunio C Hamano <gitster@pobox.com>2011-02-10 14:08:09 -0800
commit46df82d5fa0f83d3c1108ad70248877d6d9b56bb (patch)
treed7780e36c5474554404623e7bcec67bd15e7b47b /git-rebase--am.sh
parentfa99c1e1e16d347a354c817d96c5abbd5a08fcd8 (diff)
downloadgit-46df82d5fa0f83d3c1108ad70248877d6d9b56bb.tar.gz
rebase: extract am code to new source file
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>
Diffstat (limited to 'git-rebase--am.sh')
-rw-r--r--git-rebase--am.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
new file mode 100644
index 0000000000..263987c55d
--- /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