+(defun diff-hl-flydiff/vc-git--symbolic-ref (file)
+ (or
+ (vc-file-getprop file 'vc-git-symbolic-ref)
+ (let* (process-file-side-effects
+ (str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
+ (vc-file-setprop file 'vc-git-symbolic-ref
+ (if str
+ (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+ (match-string 2 str)
+ str))))))
+
+(defun diff-hl-flydiff/vc-git-working-revision (_file)
+ "Git-specific version of `vc-working-revision'."
+ (let (process-file-side-effects)
+ (vc-git--rev-parse "HEAD")))
+
+(defun diff-hl-flydiff/vc-git-mode-line-string (file)
+ "Return a string for `vc-mode-line' to put in the mode line for FILE."
+ (let* ((rev (vc-working-revision file))
+ (disp-rev (or (diff-hl-flydiff/vc-git--symbolic-ref file)
+ (substring rev 0 7)))
+ (def-ml (vc-default-mode-line-string 'Git file))
+ (help-echo (get-text-property 0 'help-echo def-ml))
+ (face (get-text-property 0 'face def-ml)))
+ (propertize (replace-regexp-in-string (concat rev "\\'") disp-rev def-ml t t)
+ 'face face
+ 'help-echo (concat help-echo "\nCurrent revision: " rev))))
+