git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git.el: Avoid a lisp error when there's no current branch (detached HEAD).

From
AJAlexandre Julliard <julliard@winehq.org>
Date
Aug 22, 2007, 10:21 UTC
Message-ID
<87r6lvna31.fsf@wine.dyndns.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 contrib/emacs/git.el |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index be44e06..abc799a 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -664,9 +664,11 @@ Return the list of files that haven't been handled."
     (ewoc-set-hf status
                  (format "Directory:  %s\nBranch:     %s\nHead:       %s%s\n"
                          default-directory
-                         (if (string-match "^refs/heads/" branch)
-                             (substring branch (match-end 0))
-                           branch)
+                         (if branch
+                             (if (string-match "^refs/heads/" branch)
+                                 (substring branch (match-end 0))
+                               branch)
+                           "none (detached HEAD)")
                          head
                          (if merge-heads
                              (concat "\nMerging:    "
-- 
1.5.3.rc6.12.g7c176

-- 
Alexandre Julliard
julliard@winehq.org
Message 1 of 1 in “git.el: Avoid a lisp error when there's no current branch (detached HEAD).”
  1. git.el: Avoid a lisp error when there's no current branch (detached HEAD).Alexandre Julliard, Aug 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.