Function: magit-wip-update-wipref

magit-wip-update-wipref is a byte-compiled function defined in magit-wip.el.

Signature

(magit-wip-update-wipref REF WIPREF TREE PARENT FILES MSG START-MSG)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-wip.el
(defun magit-wip-update-wipref (ref wipref tree parent files msg start-msg)
  (cond
    ((and (not (equal parent wipref))
          (or (not magit-wip-merge-branch)
              (not (magit-rev-verify wipref))))
     (setq start-msg (concat "start autosaving " start-msg))
     (magit-wip--update-ref wipref start-msg
                            (magit-git-string "commit-tree" "--no-gpg-sign"
                                              "-p" parent "-m" start-msg
                                              (concat parent "^{tree}")))
     (setq parent wipref))
    ((and magit-wip-merge-branch
          (or (not (magit-rev-ancestor-p ref wipref))
              (not (magit-rev-ancestor-p
                    (concat (magit-git-string "log" "--format=%H"
                                              "-1" "--merges" wipref)
                            "^2")
                    ref))))
     (setq start-msg (format "merge %s into %s" ref start-msg))
     (magit-wip--update-ref wipref start-msg
                            (magit-git-string "commit-tree" "--no-gpg-sign"
                                              "-p" wipref "-p" ref
                                              "-m" start-msg
                                              (concat ref "^{tree}")))
     (setq parent wipref)))
  (when (magit-git-failure "diff-tree" "--quiet" parent tree "--" files)
    (unless (and msg (not (= (aref msg 0) ?\s)))
      (let ((len (length files)))
        (setq msg (concat
                   (cond ((= len 0) "autosave tracked files")
                         ((> len 1) (format "autosave %s files" len))
                         ((concat "autosave "
                                  (file-relative-name (car files)
                                                      (magit-toplevel)))))
                   msg))))
    (magit-wip--update-ref wipref msg
                           (magit-git-string "commit-tree" "--no-gpg-sign"
                                             "-p" parent "-m" msg tree))))