emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 3a71ee2f18: Use 10 digit hash to document git


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 3a71ee2f18: Use 10 digit hash to document git based install (Was: Remove bad test case) (#159)
Date: Fri, 4 Feb 2022 13:57:33 -0500 (EST)

branch: externals/hyperbole
commit 3a71ee2f182d0457bb814e091095f1b24ca4ddad
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Use 10 digit hash to document git based install (Was: Remove bad test case) 
(#159)
    
    * Remove bad test case
    
    * Use 10 digit hash for git install
---
 ChangeLog          |  4 ++++
 hypb.el            |  4 +++-
 test/hypb-tests.el | 33 +++++++++++++--------------------
 3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 958986e9c4..a1ce29804a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-02-03  Mats Lidell  <matsl@gnu.org>
+
+* hypb.el (hypb--installation-type): Return 10 digit git hash.
+
 2022-02-02  Mats Lidell  <matsl@gnu.org>
 
 * hargs.el (hargs:reading-type): Renaming var.
diff --git a/hypb.el b/hypb.el
index ef55c7c775..fe1c92ed2c 100644
--- a/hypb.el
+++ b/hypb.el
@@ -118,7 +118,9 @@ Global keymap is used unless optional KEYMAP is given."
      ((file-exists-p (expand-file-name ".git" hyperb:dir))
       (ignore-errors
         (let ((default-directory hyperb:dir))
-          (list "git" (shell-command-to-string "git rev-parse HEAD"))))))))
+          (list
+           "git"
+           (substring (shell-command-to-string "git rev-parse HEAD") 0 
10))))))))
 
 ;;;###autoload
 (defun hypb:configuration (&optional out-buf)
diff --git a/test/hypb-tests.el b/test/hypb-tests.el
index 2e5382bfd9..853fdc2f00 100644
--- a/test/hypb-tests.el
+++ b/test/hypb-tests.el
@@ -92,26 +92,19 @@
     (should (equal (hypb:replace-match-string "\\`\\|x" "--xx--" "z")
                    "z--zz--"))))
 
-;; RSW 2022-01-29: Comment this out until Mats and I decide how it should work
-;; (ert-deftest hypb--installation-type-test ()
-;;   "Verify installation type alternatives."
-;;   (let ((hyperb:dir 
"/home/user/.emacs.d/elpa/hyperbole-8.0.0pre0.20220126.1138"))
-;;     (should (equal (hypb--installation-type) '("elpa-devel" 
"8.0.0pre0.20220126.1138"))))
-;;   (let ((hyperb:dir "/a_git_folder"))
-;;     (with-mock
-;;       (mock (file-exists-p "/a_git_folder/.git") => t)
-;;       (mock (shell-command-to-string "git rev-parse HEAD") => "abcdefg")
-;;       (should (equal (hypb--installation-type) '("git" "abcdefg")))))
-;;   (let ((hyperb:dir "/a_git_folder"))
-;;     (with-mock
-;;       (mock (file-exists-p "/a_git_folder/.git") => t)
-;;       (cl-letf (((symbol-function 'shell-command-to-string)
-;;                  (lambda (_cmd) (error "Something bad happend"))))
-;;         (should (equal (hypb--installation-type) '("git" "abcdefg"))))))
-;;   (let ((hyperb:dir "/a_git_folder"))
-;;     (with-mock
-;;       (mock (file-exists-p "/a_git_folder/.git") => nil)
-;;       (should-not (hypb--installation-type)))))
+(ert-deftest hypb--installation-type-test ()
+  "Verify installation type alternatives."
+  (let ((hyperb:dir 
"/home/user/.emacs.d/elpa/hyperbole-8.0.0pre0.20220126.1138"))
+    (should (equal (hypb--installation-type) '("elpa-devel" 
"8.0.0pre0.20220126.1138"))))
+  (let ((hyperb:dir "/a_git_folder"))
+    (with-mock
+      (mock (file-exists-p "/a_git_folder/.git") => t)
+      (mock (shell-command-to-string "git rev-parse HEAD") => 
"d43d05a0973e8adcbfdd8c85681dac5de669aaa9")
+      (should (equal (hypb--installation-type) '("git" "d43d05a097")))))
+  (let ((hyperb:dir "/a_git_folder"))
+    (with-mock
+      (mock (file-exists-p "/a_git_folder/.git") => nil)
+      (should-not (hypb--installation-type)))))
 
 ;; This file can't be byte-compiled without the `el-mock' package (because of
 ;; the use of the `with-mock' macro), which is not a dependency of Hyperbole.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]