Subject: bug#21166: 24.4; vc-mode and git error on newly added file to new repository

From: Dmitry Gutov <[email-masked]>
Date: Fri, 31 Jul 2015 20:25:33 +0300

On 07/31/2015 05:43 PM, Ed Avis wrote:

> Type some text in the buffer, save with C-x C-s, then ask for a diff
> with C-x v =.  This fails with the following text at the bottom of the screen:
>
> -UU-:----F1  a              All L1    Git@master  (Fundamental) ---
> fatal: bad revision 'HEAD'

Indeed, I can reproduce this.

But it's a relatively rare situation (no commits in the repo yet), and 
the git diff output will be less useful than usual, since it's a given 
that all your files are either added or simply unregistered.

To fix this, it seems we'll have to add an extra process call to 
determine whether HEAD is a valid reference (Git internals apparently do 
that). I'm not sure it's worth it.