X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-rebase--interactive.sh;h=061cd0a69e22a51a73488b89ffb99a934fd58ce1;hb=4b7f59af2a5b072a0a3950c956842e4d6223a167;hp=ac1f5a2d3f5c1bd706989b58d0e381821da05062;hpb=dfa49f33489dbb142bcc796a4e932863f9dcce1f;p=git.git diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index ac1f5a2d3..061cd0a69 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -17,7 +17,7 @@ USAGE='(--continue | --abort | --skip | [--preserve-merges] [--verbose] require_work_tree DOTEST="$GIT_DIR/.dotest-merge" -TODO="$DOTEST"/todo +TODO="$DOTEST"/git-rebase-todo DONE="$DOTEST"/done MSG="$DOTEST"/message SQUASH_MSG="$DOTEST"/message-squash @@ -102,7 +102,7 @@ pick_one () { pick_one_preserving_merges "$@" && return parent_sha1=$(git rev-parse --verify $sha1^ 2>/dev/null) current_sha1=$(git rev-parse --verify HEAD) - if [ $current_sha1 = $parent_sha1 ]; then + if test $current_sha1 = $parent_sha1; then output git reset --hard $sha1 test "a$1" = a-n && output git reset --soft $current_sha1 sha1=$(git rev-parse --short $sha1) @@ -116,7 +116,7 @@ pick_one_preserving_merges () { case "$1" in -n) sha1=$2 ;; *) sha1=$1 ;; esac sha1=$(git rev-parse $sha1) - if [ -f "$DOTEST"/current-commit ] + if test -f "$DOTEST"/current-commit then current_commit=$(cat "$DOTEST"/current-commit) && git rev-parse HEAD > "$REWRITTEN"/$current_commit && @@ -130,7 +130,7 @@ pick_one_preserving_merges () { new_parents= for p in $(git rev-list --parents -1 $sha1 | cut -d\ -f2-) do - if [ -f "$REWRITTEN"/$p ] + if test -f "$REWRITTEN"/$p then preserve=f new_p=$(cat "$REWRITTEN"/$p) @@ -188,7 +188,7 @@ nth_string () { } make_squash_message () { - if [ -f "$SQUASH_MSG" ]; then + if test -f "$SQUASH_MSG"; then COUNT=$(($(sed -n "s/^# This is [^0-9]*\([0-9]\+\).*/\1/p" \ < "$SQUASH_MSG" | tail -n 1)+1)) echo "# This is a combination of $COUNT commits." @@ -250,16 +250,18 @@ do_next () { case "$(peek_next_command)" in squash) EDIT_COMMIT= + USE_OUTPUT=output cp "$MSG" "$SQUASH_MSG" ;; *) EDIT_COMMIT=-e + USE_OUTPUT= test -f "$SQUASH_MSG" && rm "$SQUASH_MSG" esac failed=f - pick_one -n $sha1 || failed=t output git reset --soft HEAD^ + pick_one -n $sha1 || failed=t author_script=$(get_author_ident_from_commit $sha1) echo "$author_script" > "$DOTEST"/author-script case $failed in @@ -267,7 +269,7 @@ do_next () { # This is like --amend, but with a different message eval "$author_script" export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE - output git commit -F "$MSG" $EDIT_COMMIT + $USE_OUTPUT git commit -F "$MSG" $EDIT_COMMIT ;; t) cp "$MSG" "$GIT_DIR"/MERGE_MSG @@ -286,7 +288,7 @@ do_next () { HEADNAME=$(cat "$DOTEST"/head-name) && OLDHEAD=$(cat "$DOTEST"/head) && SHORTONTO=$(git rev-parse --short $(cat "$DOTEST"/onto)) && - if [ -d "$REWRITTEN" ] + if test -d "$REWRITTEN" then test -f "$DOTEST"/current-commit && current_commit=$(cat "$DOTEST"/current-commit) && @@ -403,7 +405,7 @@ do require_clean_work_tree - if [ ! -z "$2"] + if test ! -z "$2" then output git show-ref --verify --quiet "refs/heads/$2" || die "Invalid branchname: $2" @@ -426,7 +428,7 @@ do echo $ONTO > "$DOTEST"/onto test -z "$STRATEGY" || echo "$STRATEGY" > "$DOTEST"/strategy test t = "$VERBOSE" && : > "$DOTEST"/verbose - if [ t = "$PRESERVE_MERGES" ] + if test t = "$PRESERVE_MERGES" then # $REWRITTEN contains files for each commit that is # reachable by at least one merge base of $HEAD and