git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[Funky] "git -p cmd" inside a bare repository

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 14, 2007, 01:29 UTC
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.

Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 2 of 10 in “Do check_repository_format() early”
  1. Do check_repository_format() earlyNguyễn Thái Ngọc Duy, Nov 29, 2007
  2. [Funky] "git -p cmd" inside a bare repositoryJunio C Hamano, Dec 14, 2007
  3. make git start-up sequence a bit more robustJunio C Hamano, Dec 14, 2007
  4. Jeff KingDec 14, 2007
  5. Jeff KingDec 14, 2007
  6. Junio C HamanoDec 14, 2007
  7. Nguyen Thai Ngoc DuyDec 14, 2007
  8. Johannes SchindelinDec 14, 2007
  9. Junio C HamanoDec 14, 2007
  10. Johannes SchindelinDec 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.