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

git update-ref fails to create reference. (bug)

From
Rafael Ascensão <rafa.almas@gmail.com>
Date
May 4, 2018, 16:28 UTC
Message-ID
<cced9e2c-7d02-47fd-109a-1185eed13e63@gmail.com>

While trying to create a pseudo reference named REF pointing to the empty tree iff it doesn't exist, I stumbled on the following:

I assume both are valid ways to create such reference:
 	a) $ echo -e option no-deref\\nupdate REF $(git hash-object -t tree /dev/null) 0000000000000000000000000000000000000000 | git update-ref --stdin
 	b) $ git update-ref --no-deref REF $(git hash-object -t tree /dev/null) 0000000000000000000000000000000000000000
While a) works, b) will throw:
	fatal: could not read ref 'REF'

Bisect seems to point to: 2c3aed138 (pseudoref: check return values from read_ref(), 2015-07-15)

Thanks, Rafael Ascensão

Next: Martin Ågren
Message 1 of 11 in “git update-ref fails to create reference. (bug)”
  1. Rafael AscensãoMay 4, 2018
  2. Martin ÅgrenMay 4, 2018
  3. Rafael AscensãoMay 5, 2018
  4. refs: handle null-oid for pseudorefsMartin Ågren, May 6, 2018
  5. David TurnerMay 6, 2018
  6. Michael HaggertyMay 7, 2018
  7. Martin ÅgrenMay 7, 2018
  8. 0/3 refs: handle zero oid for pseudorefsMartin Ågren, May 10, 2018
  9. 1/3 refs.c: refer to "object ID", not "sha1", in error messagesMartin Ågren, May 10, 2018
  10. 2/3 t1400: add tests around adding/deleting pseudorefsMartin Ågren, May 10, 2018
  11. 3/3 refs: handle zero oid for pseudorefsMartin Ågren, May 10, 2018

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.