"John Cai via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: John Cai <johncai86@xxxxxxxxx> > > 44451a2e5e (attr: teach "--attr-source=<tree>" global option to "git", > 2023-05-06) provided the ability to pass in a treeish as the attr > source. When a revision does not resolve to a valid tree is passed, Git > will die. GitLab keeps bare repositories and always reads attributes > from the default branch, so we pass in HEAD to --attr-source. Makes sense. > With empty repositories however, HEAD does not point to a valid treeish, > causing Git to die. This means we would need to check for a valid > treeish each time. Naturally. > To avoid this, let's add a configuration that allows > Git to simply ignore --attr-source if it does not resolve to a valid > tree. Not convincing at all as to the reason why we want to do anything "to avoid this". "git log" in a repository whose HEAD does not point to a valid treeish. "git blame" dies with "no such ref: HEAD". An empty repository (more precisely, an unborn history) needs special casing if you want to present it if you do not want to spew underlying error messages to the end users *anyway*. It is unclear why seeing what commit the HEAD pointer points at (or which branch it points at for that matter) is *an* *extra* and *otherwise* *unnecessary* overhead that need to be avoided.