From: Junio C Hamano Date: Fri, 14 Dec 2007 01:29:23 GMT Subject: [Funky] "git -p cmd" inside a bare repository Message-ID: <7vmysexdvw.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20071129122139.GA11176@laptop> If you have a bare repository and try this there: $ PAGER=head git show HEAD:gcc/ChangeLog it works as expected, but if you explicitly ask for pagination, like this: $ PAGER=head git -p show HEAD:gcc/ChangeLog you would get a very funky error message: fatal: ambiguous argument 'HEAD:gcc/ChangeLog': unknown revision or path not in the working tree. Use '--' to separate paths from revisions as if we are working with a repository with working tree. I originally noticed this with ls-tree. The symptom is a bit different: $ git -p ls-tree HEAD fatal: Not a valid object name HEAD I _think_ what is happening is that setup_pager() tries to run git_config(), which runs setup(), and then RUN_SETUP set for "ls-tree" (or "show") internal command runs setup again. HEAD is given to resolve_ref() and git_path("%s", ref) makes it to ".git/HEAD", even though in a bare repository git_dir should be set to ".", and of course we cannot find such a path in the git directory.