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

Re: git gc seems to break --symbolic-full-name

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 21, 2017, 18:56 UTC
Message-ID
<xmqqbmodhb5h.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<234492d7-7fd6-f847-8b85-010732ff43b6@list.ru>
Stas Sergeev <stsp@list.ru> writes:
Show 13 quoted lines
> I do the following:
>
> $ git rev-parse --symbolic-full-name devel
> refs/heads/devel
> $ ls -l .git/`git rev-parse --symbolic-full-name devel`
> -rw-rw-r-- 1 stas stas 41 июл 21 15:05 .git/refs/heads/devel
>
> This is fine. But after git gc:
>
> $ git rev-parse --symbolic-full-name devel
> refs/heads/devel
> $ LC_ALL=C ls -l .git/`git rev-parse --symbolic-full-name devel`
> ls: cannot access '.git/refs/heads/devel': No such file or directory

This is expected, and in the modern world (like, after year 2007), a refname "refs/heads/foo" does *not* mean that there is a file with such a path under .git/ directory. "rev-parse" does not return any "path" in the filesystem sense.

See "git pack-refs --help", and depending on what you want to learn about the ref in question, perhaps "git show-ref refs/heads/devel" is what you want.

Previous: Stas SergeevNext: Stas Sergeev
Message 2 of 12 in “git gc seems to break --symbolic-full-name”
  1. Stas SergeevJul 21, 2017
  2. Junio C HamanoJul 21, 2017
  3. Stas SergeevJul 21, 2017
  4. Jacob KellerJul 23, 2017
  5. Stas SergeevJul 23, 2017
  6. Jacob KellerJul 24, 2017
  7. Stas SergeevJul 24, 2017
  8. Stas SergeevJul 26, 2017
  9. Jacob KellerJul 26, 2017
  10. Stas SergeevJul 26, 2017
  11. Jeff KingJul 26, 2017
  12. Stas SergeevJul 26, 2017

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.