update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-wip.el --- commit snapshots to work-in-progress refs -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2010-2021 The Magit Project Contributors
|
||||
;; Copyright (C) 2010-2022 The Magit Project Contributors
|
||||
;;
|
||||
;; You should have received a copy of the AUTHORS.md file which
|
||||
;; lists all contributors. If not, see http://magit.vc/authors.
|
||||
@@ -8,6 +8,8 @@
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
;; Magit is free software; you can redistribute it and/or modify it
|
||||
;; under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
@@ -30,9 +32,6 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'subr-x))
|
||||
|
||||
(require 'magit-core)
|
||||
(require 'magit-log)
|
||||
|
||||
@@ -288,30 +287,35 @@ commit message."
|
||||
(magit-wip-update-wipref ref wipref tree parent files msg "index")))
|
||||
|
||||
(defun magit-wip-commit-worktree (ref files msg)
|
||||
(let* ((wipref (magit--wip-wtree-ref ref))
|
||||
(parent (magit-wip-get-parent ref wipref))
|
||||
(tree (magit-with-temp-index parent (list "--reset" "-i")
|
||||
(if files
|
||||
;; Note: `update-index' is used instead of `add'
|
||||
;; because `add' will fail if a file is already
|
||||
;; deleted in the temporary index.
|
||||
(magit-call-git
|
||||
"update-index" "--add" "--remove"
|
||||
(and (pcase (magit-repository-local-get
|
||||
'update-index-has-ignore-sw-p 'unset)
|
||||
(`unset
|
||||
(let ((val (version<= "2.25.0"
|
||||
(magit-git-version))))
|
||||
(magit-repository-local-set
|
||||
'update-index-has-ignore-sw-p val)
|
||||
val))
|
||||
(val val))
|
||||
"--ignore-skip-worktree-entries")
|
||||
"--" files)
|
||||
(magit-with-toplevel
|
||||
(magit-call-git "add" "-u" ".")))
|
||||
(magit-git-string "write-tree"))))
|
||||
(magit-wip-update-wipref ref wipref tree parent files msg "worktree")))
|
||||
(when (or (not files)
|
||||
;; `update-index' will either ignore (before Git v2.32.0)
|
||||
;; or fail when passed directories (relevant for the
|
||||
;; untracked files code paths).
|
||||
(setq files (seq-remove #'file-directory-p files)))
|
||||
(let* ((wipref (magit--wip-wtree-ref ref))
|
||||
(parent (magit-wip-get-parent ref wipref))
|
||||
(tree (magit-with-temp-index parent (list "--reset" "-i")
|
||||
(if files
|
||||
;; Note: `update-index' is used instead of `add'
|
||||
;; because `add' will fail if a file is already
|
||||
;; deleted in the temporary index.
|
||||
(magit-call-git
|
||||
"update-index" "--add" "--remove"
|
||||
(and (pcase (magit-repository-local-get
|
||||
'update-index-has-ignore-sw-p 'unset)
|
||||
(`unset
|
||||
(let ((val (version<= "2.25.0"
|
||||
(magit-git-version))))
|
||||
(magit-repository-local-set
|
||||
'update-index-has-ignore-sw-p val)
|
||||
val))
|
||||
(val val))
|
||||
"--ignore-skip-worktree-entries")
|
||||
"--" files)
|
||||
(magit-with-toplevel
|
||||
(magit-call-git "add" "-u" ".")))
|
||||
(magit-git-string "write-tree"))))
|
||||
(magit-wip-update-wipref ref wipref tree parent files msg "worktree"))))
|
||||
|
||||
(defun magit-wip-update-wipref (ref wipref tree parent files msg start-msg)
|
||||
(cond
|
||||
@@ -443,7 +447,10 @@ many \"branches\" of each wip ref are shown."
|
||||
(when-let ((reflog (magit-git-lines "reflog" wipref)))
|
||||
(let (tips)
|
||||
(while (and reflog (> count 1))
|
||||
(setq reflog (cl-member "^[^ ]+ [^:]+: restart autosaving"
|
||||
;; "start autosaving ..." is the current message, but it used
|
||||
;; to be "restart autosaving ...", and those messages may
|
||||
;; still be around (e.g., if gc.reflogExpire is to "never").
|
||||
(setq reflog (cl-member "^[^ ]+ [^:]+: \\(?:re\\)?start autosaving"
|
||||
reflog :test #'string-match-p))
|
||||
(when (and (cadr reflog)
|
||||
(string-match "^[^ ]+ \\([^:]+\\)" (cadr reflog)))
|
||||
|
||||
Reference in New Issue
Block a user