summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>2011-02-06 13:43:32 -0500
committerJunio C Hamano <gitster@pobox.com>2011-02-10 14:08:07 -0800
commit10ffca7db2946b4392a38a8f114a0cb3fd6e069c (patch)
tree31c12c89a5e57dce712e7b86aea9e6d810d02c22 /git-rebase.sh
parent02ac45fa628ef7c529e63bb99fe198704606e7f8 (diff)
downloadgit-10ffca7db2946b4392a38a8f114a0cb3fd6e069c.tar.gz
rebase: read state outside loop
The 'onto_name' state used in 'git rebase --merge' is currently read once for each commit that need to be applied. It doesn't change between each iteration, however, so it should be moved out of the loop. This also makes the code more readable. Also remove the unused variable 'end'. 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.sh')
-rwxr-xr-xgit-rebase.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 63b56837aa..70948bcd23 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -62,6 +62,7 @@ read_state () {
then
state_dir="$merge_dir"
prev_head=$(cat "$merge_dir"/prev_head) &&
+ onto_name=$(cat "$merge_dir"/onto_name) &&
end=$(cat "$merge_dir"/end) &&
msgnum=$(cat "$merge_dir"/msgnum)
else
@@ -123,9 +124,8 @@ call_merge () {
hd=$(git rev-parse --verify HEAD)
cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)
msgnum=$(cat "$merge_dir/msgnum")
- end=$(cat "$merge_dir/end")
eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
- eval GITHEAD_$hd='$(cat "$merge_dir/onto_name")'
+ eval GITHEAD_$hd='$onto_name'
export GITHEAD_$cmt GITHEAD_$hd
if test -n "$GIT_QUIET"
then