append_matching_ref(): rewrite to take an object_id argument
[gitweb.git] / git-rebase--merge.sh
index 838fbed6c91053a83b1d6360f4cc4930ee2c2290..2cc2a6d2734c0ef12222004f22d717f4f724d82f 100644 (file)
@@ -24,10 +24,10 @@ continue_merge () {
                die "$resolvemsg"
        fi
 
-       cmt=`cat "$state_dir/current"`
+       cmt=$(cat "$state_dir/current")
        if ! git diff-index --quiet --ignore-submodules HEAD --
        then
-               if ! git commit --no-verify -C "$cmt"
+               if ! git commit ${gpg_sign_opt:+"$gpg_sign_opt"} --no-verify -C "$cmt"
                then
                        echo "Commit failed, please do not call \"git commit\""
                        echo "directly, but instead do one of the following: "
@@ -53,11 +53,12 @@ continue_merge () {
 }
 
 call_merge () {
-       cmt="$(cat "$state_dir/cmt.$1")"
+       msgnum="$1"
+       echo "$msgnum" >"$state_dir/msgnum"
+       cmt="$(cat "$state_dir/cmt.$msgnum")"
        echo "$cmt" > "$state_dir/current"
        hd=$(git rev-parse --verify HEAD)
        cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)
-       msgnum=$(cat "$state_dir/msgnum")
        eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
        eval GITHEAD_$hd='$onto_name'
        export GITHEAD_$cmt GITHEAD_$hd
@@ -93,10 +94,8 @@ finish_rb_merge () {
        if test -s "$state_dir"/rewritten
        then
                git notes copy --for-rewrite=rebase <"$state_dir"/rewritten
-               if test -x "$GIT_DIR"/hooks/post-rewrite
-               then
-                       "$GIT_DIR"/hooks/post-rewrite rebase <"$state_dir"/rewritten
-               fi
+               hook="$(git rev-parse --git-path hooks/post-rewrite)"
+               test -x "$hook" && "$hook" rebase <"$state_dir"/rewritten
        fi
        say All done.
 }
@@ -143,7 +142,7 @@ echo "$onto_name" > "$state_dir/onto_name"
 write_basic_state
 
 msgnum=0
-for cmt in `git rev-list --reverse --no-merges "$revisions"`
+for cmt in $(git rev-list --reverse --no-merges "$revisions")
 do
        msgnum=$(($msgnum + 1))
        echo "$cmt" > "$state_dir/cmt.$msgnum"