Page MenuHomePhabricator

Update "git rev-parse --show-toplevel" for Git 2.25.0
Closed, ResolvedPublic

Description

See PHI1607. In Git 2.25.0, the behavior of git rev-parse --show-toplevel has changed when the working copy is a bare git repository.

Here's the changelog note:

* "git rev-parse --show-toplevel" run outside of any working tree did
  not error out, which has been corrected.

We use git rev-parse --show-toplevel to verify that repository working copies (usually /var/repo/123/) are valid. This no longer works.

A similar issue arose in Git LFS:

https://github.com/git-lfs/git-lfs/pull/3940

They resolved it there by falling back to git rev-parse --git-dir, which seems reasonable.

(There's also --absolute-git-dir, but not until Git 2.13.0.)