[PATCH/WIP 3/8] rebase: turn rebase--am into a separate program
From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 23:04:11
Subsystem:
kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers:
Nathan Chancellor, Nicolas Schier, Linus Torvalds
--- Makefile | 2 +- git-rebase--am.sh (mode +x) | 34 ++++++++++++++++++++++++++++++++++ git-rebase.sh | 11 ++++++++++- 3 files changed, 45 insertions(+), 2 deletions(-) mode change 100644 => 100755 git-rebase--am.sh
diff --git a/Makefile b/Makefile
index 1b30d7b..93151f4 100644
--- a/Makefile
+++ b/Makefile@@ -445,6 +445,7 @@ SCRIPT_SH += git-mergetool.sh SCRIPT_SH += git-pull.sh SCRIPT_SH += git-quiltimport.sh SCRIPT_SH += git-rebase.sh +SCRIPT_SH += git-rebase--am.sh SCRIPT_SH += git-repack.sh SCRIPT_SH += git-request-pull.sh SCRIPT_SH += git-stash.sh
@@ -453,7 +454,6 @@ SCRIPT_SH += git-web--browse.sh SCRIPT_LIB += git-mergetool--lib SCRIPT_LIB += git-parse-remote -SCRIPT_LIB += git-rebase--am SCRIPT_LIB += git-rebase--interactive SCRIPT_LIB += git-rebase--merge SCRIPT_LIB += git-sh-setup
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
old mode 100644
new mode 100755
index 97f31dc..ab84330
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh@@ -3,6 +3,40 @@ # Copyright (c) 2010 Junio C Hamano. # +. git-sh-setup +. git-sh-i18n +set_reflog_action rebase +require_work_tree_exists + +GIT_QUIET=$git_quiet + +write_basic_state () { + 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 && + test t = "$verbose" && : > "$state_dir"/verbose + test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy + test -n "$strategy_opts" && echo "$strategy_opts" > \ + "$state_dir"/strategy_opts + test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \ + "$state_dir"/allow_rerere_autoupdate +} + +move_to_original_branch () { + case "$head_name" in + refs/*) + message="rebase finished: $head_name onto $onto" + git update-ref -m "$message" \ + $head_name $(git rev-parse HEAD) $orig_head && + git symbolic-ref \ + -m "rebase finished: returning to $head_name" \ + HEAD $head_name || + die "$(gettext "Could not move back to $head_name")" + ;; + esac +} + case "$action" in continue) git am --resolved --resolvemsg="$resolvemsg" &&
diff --git a/git-rebase.sh b/git-rebase.sh
index b2f1c76..42e868d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh@@ -149,7 +149,16 @@ run_specific_rebase () { export GIT_EDITOR autosquash= fi - . git-rebase--$type + git_quiet=$GIT_QUIET + export GIT_PAGER + export action allow_rerere_autoupdate git_am_opt git_quiet head_name keep_empty + export onto orig_head rebase_root resolvemsg revisions + export state_dir verbose strategy strategy_opts + if [ "$type" = am ]; then + exec git-rebase--am + else + . git-rebase--$type + fi } run_pre_rebase_hook () {
--
2.3.0.rc1.137.g477eb31