git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.
- From
Rafael Ascensao <rafa.almas@gmail.com>
- Date
- Mar 26, 2018, 21:27 UTC
- Message-ID
- <CACUQV5_3Pw+vnyyNUL4oE4tMLG_wKVdqdVk01rg4V92ufUYHHA@mail.gmail.com>
One of the tools that manages PKGBUILDS for Arch Linux stores PKGBUILD git repos inside a cache directory for reuse.
One of the repos is triggering some unexpected behaviour that can be reproduced in the CLI with:
$ GIT_DIR=spotify/.git GIT_WORK_TREE=spotify git reset HEAD fatal: couldn't read spotify/.git/packed-refs: Not a directory
Moving up one directory works as expected. $ cd .. $ GIT_DIR=sync/spotify/.git GIT_WORK_TREE=sync/spotify git reset HEAD
Using -C seems to work fine too. $ git -C spotify reset HEAD
$ GIT_TRACE_SETUP=2 GIT_TRACE=2 GIT_DIR="spotify/.git" GIT_WORK_TREE="spotify" git reset HEAD 22:10:53.020525 trace.c:315 setup: git_dir: spotify/.git 22:10:53.020605 trace.c:316 setup: git_common_dir: spotify/.git 22:10:53.020616 trace.c:317 setup: worktree: /home/rafasc/.cache/aurutils/sync/spotify 22:10:53.020625 trace.c:318 setup: cwd: /home/rafasc/.cache/aurutils/sync 22:10:53.020635 trace.c:319 setup: prefix: (null) 22:10:53.020644 git.c:344 trace: built-in: git 'reset' 'HEAD' fatal: couldn't read spotify/.git/packed-refs: Not a directory
The issue seems to bisect to f57f37e2e1bf11ab4cdfd221ad47e961ba9353a0 I can't pinpoint why this particular repo is behaving differently.
Cumprimentos, Rafael Ascensão