From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: claudio.bley@gmail.com (Claudio Bley) Newsgroups: gmane.emacs.bugs Subject: bug#14459: git vc-annotate fails in detached HEAD state Date: Fri, 24 May 2013 15:07:37 +0200 Message-ID: <87wqqopluu.wl%claudio.bley@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1369402671 24593 80.91.229.3 (24 May 2013 13:37:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 May 2013 13:37:51 +0000 (UTC) To: 14459@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 24 15:37:49 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UfsBp-0006T3-AG for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 May 2013 15:37:49 +0200 Original-Received: from localhost ([::1]:45509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfsBo-0005HF-TK for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 May 2013 09:37:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfsBG-00045W-My for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:37:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfsB9-0001jJ-QI for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:37:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfsB9-0001jF-Nr for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:37:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UfsC2-0005D1-RR for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:38:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: claudio.bley@gmail.com (Claudio Bley) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 May 2013 13:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.136940266919980 (code B ref -1); Fri, 24 May 2013 13:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 May 2013 13:37:49 +0000 Original-Received: from localhost ([127.0.0.1]:59987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfsBm-0005CA-Ib for submit@debbugs.gnu.org; Fri, 24 May 2013 09:37:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51191) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UfsBh-0005Bh-NQ for submit@debbugs.gnu.org; Fri, 24 May 2013 09:37:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfsAd-0001Y1-54 for submit@debbugs.gnu.org; Fri, 24 May 2013 09:36:41 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:42261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfrpY-000125-4c for submit@debbugs.gnu.org; Fri, 24 May 2013 09:14:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfrpW-0002o4-LV for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:14:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufrij-00070v-CW for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:07:53 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufrij-00070Y-3Y for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 09:07:45 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ufrih-00051r-Le for bug-gnu-emacs@gnu.org; Fri, 24 May 2013 15:07:43 +0200 Original-Received: from 178-24-168-244-dynip.superkabel.de ([178.24.168.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 May 2013 15:07:43 +0200 Original-Received: from claudio.bley by 178-24-168-244-dynip.superkabel.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 May 2013 15:07:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 178-24-168-244-dynip.superkabel.de User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL/10.8 Emacs/24.3.50 (i386-mingw-nt6.1.7601) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74523 Archived-At: Hi. 1. I open a git versioned file with vc-git enabled in a directory currently in detached HEAD state (e.g. after checking out a tag) 2. notice the mode line says "Git:!" Now, when I do C-x v g (vc-annotate) The annotation buffer will be displayed, only saying ,---- | fatal: bad revision '' `---- Apparently, vc-git-working-revision calls "git symbolic-ref HEAD", which - in this case - gives: $ git symbolic-ref HEAD fatal: ref HEAD is not a symbolic ref So, vc-git-working-revision returns an empty string as the current "revision" vc-mode refers to. M-: (vc-git-working-revision (buffer-file-name)) -> "" When calling vc-annotate, the vc-git-annotate-command gets called with the empty string for the rev parameter leading to the error. This patch fixes it for me: ----------------- 8< --------------------- 8< ------------- diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 06474cb..63a7115 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -885,7 +885,7 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-annotate-command (file buf &optional rev) (let ((name (file-relative-name file))) - (vc-git-command buf 'async nil "blame" "--date=iso" "-C" "-C" rev "--" name))) + (vc-git-command buf 'async nil "blame" "--date=iso" "-C" "-C" (if (> (length rev) 0) rev) "--" name))) (declare-function vc-annotate-convert-time "vc-annotate" (time)) -- Claudio