summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eacd13e)
raw | patch | inline | side by side (parent: eacd13e)
author | Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> | |
Tue, 28 Dec 2010 09:30:41 +0000 (10:30 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 28 Dec 2010 23:05:29 +0000 (15:05 -0800) |
Extrace the code for writing the state to rebase-apply/ or
rebase-merge/ when a rebase is initiated. This will make it easier to
later make both interactive and non-interactive rebase remember the
options used.
Note that non-interactive rebase stores the sha1 of the original head
in a file called orig-head, while interactive rebase stores it in a
file called head.
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
rebase-merge/ when a rebase is initiated. This will make it easier to
later make both interactive and non-interactive rebase remember the
options used.
Note that non-interactive rebase stores the sha1 of the original head
in a file called orig-head, while interactive rebase stores it in a
file called head.
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--am.sh | patch | blob | history | |
git-rebase--interactive.sh | patch | blob | history | |
git-rebase--merge.sh | patch | blob | history | |
git-rebase.sh | patch | blob | history |
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 931676115aa5a5e55c3f96df6d6ac1853c65cc29..5acfa0037fe2c84c3e0a85d1e31ea8118efd835b 100644 (file)
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
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"
+test 0 != $ret -a -d "$state_dir" && write_basic_state
exit $ret
index 1079994c7134b1351583fe26d14c247aecb438d5..a33b2463cbaff3255aecca0f475bb7cfb94341d2 100755 (executable)
mkdir "$state_dir" || die "Could not create temporary $state_dir"
: > "$state_dir"/interactive || die "Could not mark as interactive"
-echo "$head_name" > "$state_dir"/head-name
-
-echo $orig_head > "$state_dir"/head
+write_basic_state
case "$rebase_root" in
'')
rm -f "$state_dir"/rebase-root ;;
*)
: >"$state_dir"/rebase-root ;;
esac
-echo $onto > "$state_dir"/onto
test -z "$strategy" || echo "$strategy" > "$state_dir"/strategy
test t = "$verbose" && : > "$state_dir"/verbose
if test t = "$preserve_merges"
diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
index 8cfdcf1b48292a24588cf4eff6384eb4d9bfdc21..705d2f5475d784e35af4aa3819587f53c257fa69 100644 (file)
--- a/git-rebase--merge.sh
+++ b/git-rebase--merge.sh
mkdir -p "$state_dir"
echo "$onto_name" > "$state_dir/onto_name"
-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"
+write_basic_state
msgnum=0
for cmt in `git rev-list --reverse --no-merges "$revisions"`
diff --git a/git-rebase.sh b/git-rebase.sh
index 7e2e97847198c8a32105814263e55810496b21fb..95c0d055e366a884253cc43ddb195d9a213b1855 100755 (executable)
--- a/git-rebase.sh
+++ b/git-rebase.sh
GIT_QUIET=$(cat "$state_dir"/quiet)
}
+write_basic_state () {
+ echo "$head_name" > "$state_dir"/head-name &&
+ echo "$onto" > "$state_dir"/onto &&
+ if test "$type" = interactive
+ then
+ echo "$orig_head" > "$state_dir"/head
+ else
+ echo "$orig_head" > "$state_dir"/orig-head
+ fi &&
+ echo "$GIT_QUIET" > "$state_dir"/quiet
+}
+
output () {
case "$verbose" in
'')
export onto autosquash strategy strategy_opts verbose rebase_root \
force_rebase action preserve_merges upstream switch_to head_name \
state_dir orig_head onto_name GIT_QUIET revisions RESOLVEMSG \
- allow_rerere_autoupdate git_am_opt
- export -f move_to_original_branch output
+ allow_rerere_autoupdate git_am_opt type
+ export -f move_to_original_branch output write_basic_state
exec git-rebase--$type
}