rebase: align variable content
Make sure to interpret variables with the same name in the same way in git-rebase.sh and git-rebase--interactive.sh. This will make it easier to factor out code from git-rebase.sh to git-rebase--interactive and export the variables. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin von Zweigbergk committed
Feb 6, 2011 at 13:43 UTC
9765b6abeb00145df18cde6b76a9b1fa97eeef53
2 files changed
+14
-6
git-rebase--interactive.sh
+11
-5
@@ -339,7 +339,8 @@ pick_one_preserving_merges () {
339
# No point in merging the first parent, that's HEAD
340
new_parents=${new_parents# $first_parent}
341
if ! do_with_author output \
342
- git merge $strategy -m "$msg_content" $new_parents
342
+ git merge ${strategy:+-s $strategy} -m \
343
+ "$msg_content" $new_parents
344
then
345
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
346
die_with_patch $sha1 "Error redoing merge $sha1"
@@ -827,11 +828,11 @@ first and then run 'git rebase --continue' again."
828
-s)
829
case "$#,$1" in
830
*,*=*)
830
- strategy="-s "$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
831
+ strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
832
1,*)
833
usage ;;
834
*)
834
- strategy="-s $2"
835
+ strategy="$2"
836
shift ;;
837
esac
838
;;
@@ -860,9 +861,9 @@ first and then run 'git rebase --continue' again."
861
autosquash=
862
;;
863
--onto)
864
+ test 2 -le "$#" || usage
865
+ onto="$2"
866
shift
864
- onto=$(parse_onto "$1") ||
865
- die "Does not point to a valid commit: $1"
867
;;
868
--)
869
shift
@@ -872,6 +873,11 @@ first and then run 'git rebase --continue' again."
873
shift
874
done
875
876
+if test -n "$onto"
877
+then
878
+ onto=$(parse_onto "$onto") || die "Does not point to a valid commit: $1"
879
+fi
880
+
881
test -z "$rebase_root" -a $# -ge 1 -a $# -le 2 ||
882
test ! -z "$rebase_root" -a $# -le 1 || usage
883
test -d "$dotest" &&
git-rebase.sh
+3
-1
@@ -43,7 +43,7 @@ If you would prefer to skip this patch, instead run \"git rebase --skip\".
43
To restore the original branch and stop rebasing run \"git rebase --abort\".
44
"
45
unset onto
46
-strategy=recursive
46
+strategy=
47
strategy_opts=
48
do_merge=
49
merge_dir="$GIT_DIR"/rebase-merge
@@ -130,6 +130,7 @@ call_merge () {
130
then
131
GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
132
fi
133
+ test -z "$strategy" && strategy=recursive
134
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
135
rv=$?
136
case "$rv" in
@@ -267,6 +268,7 @@ do
268
esac
269
strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$newopt")"
270
do_merge=t
271
+ test -z "$strategy" && strategy=recursive
272
;;
273
-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
274
--strateg=*|--strategy=*|\