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

git fetch-pack can't fetch refs/stash

From
SMStefan (metze) Metzmacher <metze@samba.org>
Date
Apr 29, 2010, 10:24 UTC
Message-ID
<4BD95E73.6040709@samba.org>
Hi,

I tried to fetch refs/stash from my repository (for backup), however 'git fetch myremote +refs/stash:refs/remotes/myremote/stash' just fails with $? = 1 (without any output).

That's confusing because 'git ls-remote myremote' shows refs/stash.
After some debugging I found the reason for the problem.

'git fetch-pack /path/to/myremote refs/stash' also just returns $? = 1.

filter_refs() skips 'refs/stash', because check_ref_format() returns CHECK_REF_FORMAT_ONELEVEL.

Is that a bug or a feature?

The easiest fix would be to allow CHECK_REF_FORMAT_ONELEVEL to pass in the same way as CHECK_REF_FORMAT_OK. But I'm not sure if that would have other side effects.

For now I work around it by doing: 'mkdir stash.d; cd stash.d; ln -s ../stash .' and use git fetch myremote +refs/stash.d/stash:refs/remotes/myremote/stash

metze
Message 1 of 1 in “git fetch-pack can't fetch refs/stash”
  1. Stefan (metze) MetzmacherApr 29, 2010

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.