]> git.eshelyaron.com Git - emacs.git/commitdiff
* vc-git.el (vc-git-previous-revision, vc-git-next-revision):
authorAlexandre Julliard <julliard@winehq.org>
Fri, 13 Mar 2009 20:04:11 +0000 (20:04 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 13 Mar 2009 20:04:11 +0000 (20:04 +0000)
Fall back to original commit if vc-git-symbolic-commit fails to
find a symbolic name.
(vc-git-symbolic-commit): Don't limit search to tags. Treat
"undefined" as an error. (Bug #2110)

lisp/ChangeLog
lisp/vc-git.el

index 49e62d952b72d3cfec423eb077a56baf8c94ffba..21c19c8b95b17494ebdc2ca24f8c50f35023f947 100644 (file)
@@ -1,3 +1,11 @@
+2009-03-13  Alexandre Julliard  <julliard@winehq.org>
+
+       * vc-git.el (vc-git-previous-revision, vc-git-next-revision):
+       Fall back to original commit if vc-git-symbolic-commit fails to
+       find a symbolic name.
+       (vc-git-symbolic-commit): Don't limit search to tags. Treat
+       "undefined" as an error. (Bug #2110)
+
 2009-03-13  D. Goel  <deego3@gmail.com>
 
        * ibuf-ext.el: 
index 64d598c271ab72905cf27cabc9066815d4ef1763..9155fba053fb6e56b21db59e60f9ed6a456350d0 100644 (file)
@@ -576,19 +576,19 @@ or BRANCH^ (where \"^\" can be repeated)."
 (defun vc-git-previous-revision (file rev)
   "Git-specific version of `vc-previous-revision'."
   (if file
-      (let ((default-directory (file-name-directory (expand-file-name file)))
-            (file (file-name-nondirectory file)))
-        (vc-git-symbolic-commit
-         (with-temp-buffer
-           (and
-            (vc-git--out-ok "rev-list" "-2" rev "--" file)
-            (goto-char (point-max))
-            (bolp)
-            (zerop (forward-line -1))
-            (not (bobp))
-            (buffer-substring-no-properties
-             (point)
-             (1- (point-max)))))))
+      (let* ((default-directory (file-name-directory (expand-file-name file)))
+             (file (file-name-nondirectory file))
+             (prev-rev (with-temp-buffer
+                         (and
+                          (vc-git--out-ok "rev-list" "-2" rev "--" file)
+                          (goto-char (point-max))
+                          (bolp)
+                          (zerop (forward-line -1))
+                          (not (bobp))
+                          (buffer-substring-no-properties
+                           (point)
+                           (1- (point-max)))))))
+        (or (vc-git-symbolic-commit prev-rev) prev-rev))
     (with-temp-buffer
       (and
        (vc-git--out-ok "rev-parse" (concat rev "^"))
@@ -609,18 +609,19 @@ or BRANCH^ (where \"^\" can be repeated)."
              (bobp)
              (buffer-substring-no-properties
               (point)
-              (1- (point-max)))))))
-    (and current-rev
-        (vc-git-symbolic-commit
-         (with-temp-buffer
-           (and
-            (vc-git--out-ok "rev-list" "HEAD" "--" file)
-            (goto-char (point-min))
-            (search-forward current-rev nil t)
-            (zerop (forward-line -1))
-            (buffer-substring-no-properties
-             (point)
-             (progn (forward-line 1) (1- (point))))))))))
+              (1- (point-max))))))
+         (next-rev
+          (and current-rev
+               (with-temp-buffer
+                 (and
+                  (vc-git--out-ok "rev-list" "HEAD" "--" file)
+                  (goto-char (point-min))
+                  (search-forward current-rev nil t)
+                  (zerop (forward-line -1))
+                  (buffer-substring-no-properties
+                   (point)
+                   (progn (forward-line 1) (1- (point)))))))))
+    (or (vc-git-symbolic-commit next-rev) next-rev)))
 
 (defun vc-git-delete-file (file)
   (vc-git-command nil 0 file "rm" "-f" "--"))
@@ -731,13 +732,14 @@ The difference to vc-do-command is that this function always invokes `git'."
   "Translate COMMIT string into symbolic form.
 Returns nil if not possible."
   (and commit
-       (with-temp-buffer
-        (and
-         (vc-git--out-ok "name-rev" "--name-only" "--tags" commit)
-         (goto-char (point-min))
-         (= (forward-line 2) 1)
-         (bolp)
-         (buffer-substring-no-properties (point-min) (1- (point-max)))))))
+       (let ((name (with-temp-buffer
+                     (and
+                      (vc-git--out-ok "name-rev" "--name-only" commit)
+                      (goto-char (point-min))
+                      (= (forward-line 2) 1)
+                      (bolp)
+                      (buffer-substring-no-properties (point-min) (1- (point-max)))))))
+         (and name (not (string= name "undefined")) name))))
 
 (provide 'vc-git)