           ;; confuse this syntax with the syntax of the
           ;; `straight-popup' macro.
           `(,@(when ref-ahead-p
-                `(("f" ,(format "Fast-forward branch %S to %s" branch ref-name)
+                `(("f" ,(format "Fast-forward branch %S to %s"
+                                branch quoted-ref-name)
                    ,(lambda ()
                       (straight--get-call
                        "git" "reset" "--hard" ref-name)))))

   (let* ((cur-branch (straight--get-call
                       "git" "rev-parse" "--abbrev-ref" "HEAD"))
          (head-detached-p (string= cur-branch "HEAD"))
          (ref-name (or ref "HEAD")))
     (cond
      ((and ref
            (not (straight--check-call

                      (straight--get-call
                       "git" "checkout" branch)))))
            ,@(unless (or ref-ahead-p ref-behind-p)
                `(("m" ,(format "Merge %S to branch %S" quoted-ref-name branch)
                   ,(lambda ()
                      (if ref
                          (straight--check-call
                           "git" "merge" ref)
                        (let ((orig-head
                               (straight--get-call
                                "git" "rev-parse" "HEAD")))
                          (straight--get-call
                           "git" "checkout" branch)
                          ;; Merge might not succeed, so don't throw
                          ;; on error.
                          (straight--check-call
                           "git" "merge" orig-head)))))
                  ("r" ,(format "Reset branch %S to %s"
                                branch quoted-ref-name)
                   ,(lambda ()
                      (straight--get-call
                       "git" "reset" "--hard" ref-name)))
