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

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

[elpa] master f791eb8: Do not assume that 'git rev-parse 1' exits with s


From: Tino Calancha
Subject: [elpa] master f791eb8: Do not assume that 'git rev-parse 1' exits with status != 0
Date: Sun, 21 Jan 2018 00:10:34 -0500 (EST)

branch: master
commit f791eb8884a799bcc8ed1ac488840b757105850d
Author: tino calancha <address@hidden>
Commit: tino calancha <address@hidden>

    Do not assume that 'git rev-parse 1' exits with status != 0
    
    For some repositories `git rev-parse 1' might returns success, with
    the reference pointing to something different that HEAD~1.
    In that case, `gited-show-commit' fails to show commit HEAD~1.
    If we reject those references, then `gited-show-commit' is forced
    to include the branch name.
    Bump version to 0.3.4.
    * packages/gited/gited.el (gited--valid-ref-p): Explicitely reject when STR 
is
    just a digit, like "0", "1", "2", etc.
---
 packages/gited/gited.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/packages/gited/gited.el b/packages/gited/gited.el
index cc7b1d5..66459dd 100644
--- a/packages/gited/gited.el
+++ b/packages/gited/gited.el
@@ -8,11 +8,11 @@
 
 ;; Created: Wed Oct 26 01:28:54 JST 2016
 ;; Compatibility: GNU Emacs: 24.4
-;; Version: 0.3.3
+;; Version: 0.3.4
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Sun Aug 13 12:49:07 JST 2017
+;; Last-Updated: Sun Jan 21 14:07:11 JST 2018
 ;;           By: calancha
-;;     Update #: 682
+;;     Update #: 683
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -1915,8 +1915,12 @@ diff OLD-REF REF."
     (gited--set-output-buffer-mode buf 'diff)))
 
 (defun gited--valid-ref-p (str)
-  (let ((args `("rev-parse" ,str)))
-    (zerop (gited-git-command args))))
+  ;; Explicitely reject when STR is just a digit, like "0", "1", "2", etc.
+  ;; For some repositories `git rev-parse 1' might returns success, with
+  ;; that reference pointing to something different that HEAD~1.
+  (unless (string-match "\\`[0-9]+\\'" str)
+    (let ((args `("rev-parse" ,str)))
+      (zerop (gited-git-command args)))))
 
 (defun gited-show-commit (branch &optional commit)
   "Show a commit of BRANCH.



reply via email to

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