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>
This commit is contained in:
Martin von Zweigbergk 2011-02-06 13:43:38 -05:00 committed by Junio C Hamano
parent 6bb4e485cf
commit 9765b6abeb
2 changed files with 14 additions and 6 deletions

View File

@ -339,7 +339,8 @@ pick_one_preserving_merges () {
# No point in merging the first parent, that's HEAD # No point in merging the first parent, that's HEAD
new_parents=${new_parents# $first_parent} new_parents=${new_parents# $first_parent}
if ! do_with_author output \ if ! do_with_author output \
git merge $strategy -m "$msg_content" $new_parents git merge ${strategy:+-s $strategy} -m \
"$msg_content" $new_parents
then then
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
die_with_patch $sha1 "Error redoing merge $sha1" die_with_patch $sha1 "Error redoing merge $sha1"
@ -827,11 +828,11 @@ first and then run 'git rebase --continue' again."
-s) -s)
case "$#,$1" in case "$#,$1" in
*,*=*) *,*=*)
strategy="-s "$(expr "z$1" : 'z-[^=]*=\(.*\)') ;; strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
1,*) 1,*)
usage ;; usage ;;
*) *)
strategy="-s $2" strategy="$2"
shift ;; shift ;;
esac esac
;; ;;
@ -860,9 +861,9 @@ first and then run 'git rebase --continue' again."
autosquash= autosquash=
;; ;;
--onto) --onto)
test 2 -le "$#" || usage
onto="$2"
shift shift
onto=$(parse_onto "$1") ||
die "Does not point to a valid commit: $1"
;; ;;
--) --)
shift shift
@ -872,6 +873,11 @@ first and then run 'git rebase --continue' again."
shift shift
done done
if test -n "$onto"
then
onto=$(parse_onto "$onto") || die "Does not point to a valid commit: $1"
fi
test -z "$rebase_root" -a $# -ge 1 -a $# -le 2 || test -z "$rebase_root" -a $# -ge 1 -a $# -le 2 ||
test ! -z "$rebase_root" -a $# -le 1 || usage test ! -z "$rebase_root" -a $# -le 1 || usage
test -d "$dotest" && test -d "$dotest" &&

View File

@ -43,7 +43,7 @@ If you would prefer to skip this patch, instead run \"git rebase --skip\".
To restore the original branch and stop rebasing run \"git rebase --abort\". To restore the original branch and stop rebasing run \"git rebase --abort\".
" "
unset onto unset onto
strategy=recursive strategy=
strategy_opts= strategy_opts=
do_merge= do_merge=
merge_dir="$GIT_DIR"/rebase-merge merge_dir="$GIT_DIR"/rebase-merge
@ -130,6 +130,7 @@ call_merge () {
then then
GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
fi fi
test -z "$strategy" && strategy=recursive
eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"' eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
rv=$? rv=$?
case "$rv" in case "$rv" in
@ -267,6 +268,7 @@ do
esac esac
strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$newopt")" strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$newopt")"
do_merge=t do_merge=t
test -z "$strategy" && strategy=recursive
;; ;;
-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\ -s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
--strateg=*|--strategy=*|\ --strateg=*|--strategy=*|\