# Repository discovery errors to say why a directory was rejected

_Kaartic Sivaraam's series would replace the blunt "not a git repository" message with causes such as a bad GIT_OBJECT_DIRECTORY, GIT_CEILING_DIRECTORIES or GIT_DIR._

Section: Patches. Edition of 2026-10-29. Written by an AI editor from the thread "[RFC PATCH 0/3] Improve error reporting to mention "why" a directory is not a repository" (30 messages): https://gitlist.dev/t/66383

Kaartic Sivaraam started from the observation that several failures produce a blunt message. With GIT_OBJECT_DIRECTORY pointing at a missing directory, "git --git-dir repo.git rev-parse --is-bare-repository" says "not a git repository: 'repo.git'", even though repo.git is valid. The series adds messages that explain why, covering GIT_OBJECT_DIRECTORY, GIT_CEILING_DIRECTORIES, and GIT_DIR or --git-dir, and adds extra discovery tests to t0009.

Junio Hamano said patches 1 to 4 of 5 made sense but he was unsure about the fifth. On the GIT_OBJECT_DIRECTORY case he said the proposed explanation was only half the story. In a healthy repository a bogus value does not make discovery fail ("git status" then reports "fatal: bad object HEAD"), while in a real non-repository it does not matter where the variable points.

On the ceiling-directories message, Hamano said the new second line gives much better information, and asked whether the old "(or any of the parent directories)" wording is still needed. He suggested combining them into one statement, for example: no valid repository ".git" found in "/home/user/.config/nvim" or any of its parent directories up to "/home/user/.config".

Sivaraam thanked him, apologised for the delay, and said v3 takes this feedback into account. The excerpts show no review of v3 yet.
