On Wed, Apr 21, 2021 at 11:09:07AM +0200, Han-Wen Nienhuys wrote: > > > diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh > > > index a4ebb0b65fec..fd5980d3fb40 100755 > > > --- a/t/t1401-symbolic-ref.sh > > > +++ b/t/t1401-symbolic-ref.sh > > > @@ -7,18 +7,13 @@ test_description='basic symbolic-ref tests' > > > # the git repo, meaning that further tests will operate on > > > # the surrounding git repo instead of the trash directory. > > > reset_to_sane() { > > > - echo ref: refs/heads/foo >.git/HEAD > > > + git --git-dir .git symbolic-ref HEAD refs/heads/foo > > > > Isn't that "--git-dir .git" entirely redundant? > > See the comment above the changed line: we don't want auto-detection > to clobber the surrounding git repo. Indeed, but then this is not a faithful conversion of the original. That 'echo' will write sane content to HEAD no matter what state the repository is in. That 'symbolic-ref' command, however, won't, because 'git --git-dir .git' turns off only repository discovery, but not repository verification, and in case of a corrupt '.git/HEAD' it will bail out. $ cd test $ git init Initialized empty Git repository in /home/szeder/src/git/test/.git/ $ git commit --allow-empty -m initial [master (root-commit) ec0df0b] initial $ echo "foo bar baz" >.git/HEAD $ git --git-dir .git symbolic-ref HEAD refs/heads/master fatal: not a git repository: '.git'