git.el: Avoid a lisp error when there's no current branch (detached HEAD).
Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexandre Julliard committed
Aug 22, 2007 at 12:21 UTC
ef08c14993a8d2881941667c0264c97c6874ccee
1 file changed
+5
-3
contrib/emacs/git.el
+5
-3
@@ -664,9 +664,11 @@ Return the list of files that haven't been handled."
664
(ewoc-set-hf status
665
(format "Directory: %s\nBranch: %s\nHead: %s%s\n"
666
default-directory
667
- (if (string-match "^refs/heads/" branch)
668
- (substring branch (match-end 0))
669
- branch)
667
+ (if branch
668
+ (if (string-match "^refs/heads/" branch)
669
+ (substring branch (match-end 0))
670
+ branch)
671
+ "none (detached HEAD)")
672
head
673
(if merge-heads
674
(concat "\nMerging: "