From: Junio C Hamano Date: Wed, 28 Oct 2026 18:57:27 GMT Subject: Re: [PATCH v3 4/5] setup: provide hint about auto-discovery boundaries Message-ID: In-Reply-To: <20261028115412.169748-5-kaartic.sivaraam@gmail.com> Kaartic Sivaraam writes: > In the same spirit as the previous commit, we want to improve the UX > of the Git repository discovery case when the GIT_CEILING_DIRECTORIES > environment varaible is set. For instance, consider the following > scenario: > > $ cd ~ && git init # dotfiles repo at ~/.git > $ echo 'export GIT_CEILING_DIRECTORIES=$HOME' >> ~/.bashrc > # stop ~/.git swallowing every > # non-repo directory under ~ > ...weeks later... > $ cd ~/.config/nvim > $ vim init.lua > $ git status > fatal: not a git repository (or any of the parent directories): .git > > The error message is a bit unhelpful as the gut reaction of the user > would be to wonder why their ~/.git directory was not discovered even > though the message says it checked the parent directories. We can't > really blame the user for not remembering that they had > GIT_CEILING_DIRECTORIES configured in their ~/.bashrc. > > Improve this error reporting UX by giving an additional hint about the > ceiling that auto-discovery was bounded by and also mention what > GIT_CEILING_DIRECTORIES was configured to. With this, the user would > see the following: > > ... > $ git status > fatal: not a git repository (or any of the parent directories): .git > searched from '/home/user/.config/nvim' up to '/home/user/.config' > $GIT_CEILING_DIRECTORIES is set to '/home/user' The second line of the output gives a much better information than before. Stepping back a bit, the "(or any of the ...)" was a weak and ineffective attempt to say that ".git" we claim is not a valid repository is not necessarily in the current directory. But would it be still needed with the more explicit "we looked for it from here to there"? Can we combine both into a single statement somehow to make it more concise and understandable? Here is my attempt. Would this fatal: no valid repository ".git" found in "/home/user/.config/nvim" or any of its parent directories up to "/home/user/.config". or something like that be easier to read? Of course, such a change would break scripts that attempt to parse this error message, so even if it is easier for humans, there could be downside. > - test_grep "not a git repository (or any of the parent directories)" stderr > + test_grep "not a git repository (or any of the parent directories)" stderr && > + test_grep "searched from .*ceil/sub.*up to.*ceil." stderr && > + test_grep "GIT_CEILING_DIRECTORIES is set to" stderr > ) > '