Commit f3f13b96 authored by Noam Postavsky's avatar Noam Postavsky

magit-get-boolean: Fix the cached case

See also [1] which discusses the same fix for magit-get.
[1]: https://github.com/magit/magit/pull/2743#issuecomment-242935014
parent 9bb5debf
......@@ -1859,7 +1859,7 @@ the reference is used. The first regexp submatch becomes the
"Return the boolean value of the Git variable specified by KEYS."
(let ((key (mapconcat 'identity keys ".")))
(if magit--refresh-cache
(equal "true" (car (magit-config-get-from-cached-list key)))
(equal "true" (car (last (magit-config-get-from-cached-list key))))
(magit-git-true "config" "--bool" key))))
(defun magit-set (value &rest keys)
......
......@@ -182,7 +182,12 @@
(should (magit-get-boolean "a" "b"))
(magit-git "config" "a.b" "false")
(should-not (magit-get-boolean "a.b"))
(should-not (magit-get-boolean "a" "b"))))
(should-not (magit-get-boolean "a" "b"))
;; Multiple values, last one wins.
(magit-git "config" "--add" "a.b" "true")
(should (magit-get-boolean "a.b"))
(let ((magit--refresh-cache (list (cons 0 0))))
(should (magit-get-boolean "a.b")))))
(ert-deftest magit-get-{current|next}-tag ()
(magit-with-test-repository
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment