ref: 80bca9e8fa64289e52841f66fbce62c0b4724b78
parent: 3313eba74efb302df2d39440c2e2be7372e65030
author: kvik <kvik@a-b.xyz>
date: Sun Jun 14 19:00:17 EDT 2020
Look for .git/HEAD to avoid getting fooled by mntgen(4) To find the git repository root we used to search upwards, starting in the current working directory, until a directory containing the .git/ subdirectory was found or the / was reached. This works fine but for the paths that cross over a mntgen(4) mountpoint, such as /mnt, in which case the search always succeeds upon reaching the mntgen(4), fooling git9 into thinking it found the repository root. We work around this by looking for a file .git/HEAD instead, which increases the likelihood that we have indeed found a git repository root.