Subject: bug#21457: 25.0.50; vc-test-git03-working-revision test fails

From: Eli Zaretskii <[email-masked]>
Date: Sat, 12 Sep 2015 18:36:41 +0300

> Date: Sat, 12 Sep 2015 18:03:38 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > > diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> > > index 8a0f554..af2b39f 100644
> > > --- a/lisp/vc/vc-git.el
> > > +++ b/lisp/vc/vc-git.el
> > > @@ -1137,7 +1137,9 @@ (defun vc-git--rev-parse (rev)
> > >    (with-temp-buffer
> > >      (and
> > >       (vc-git--out-ok "rev-parse" rev)
> > > -     (buffer-substring-no-properties (point-min) (+ (point-min) 40)))))
> > > +     (buffer-substring-no-properties (point-min)
> > > +                                     (min (1- (point-max))
> > > +                                          (+ (point-min) 40))))))
> > 
> > Why does vc-git--out-ok return true when git rev-parse failed?
> 
> Good question

Answer: that's my local 'git' script, if I invoke the Git binary
directly, the result is 128.

But I still don't understand how this

	  ;; Create empty repository.  Check working revision of
	  ;; repository, should be nil.
	  (make-directory default-directory)
	  (vc-test--create-repo-function backend)

	  ;; nil: CVS Mtn RCS SCCS
	  ;; "0": Bzr Hg SRC SVN
	  ;; "master" or "HEAD": Git
	  (should (eq (vc-working-revision default-directory)
		      (vc-working-revision default-directory backend)))

was supposed to work, since "git rev-parse HEAD" fails in an empty
repository and returns just "HEAD", not a 40-digit hash or "master".

What am I missing?