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

Re: Be more careful about updating refs

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jan 16, 2008, 00:02 UTC
Message-ID
<alpine.LFD.1.00.0801151600140.2806@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.00.0801151546560.2806@woody.linux-foundation.org>
On Tue, 15 Jan 2008, Linus Torvalds wrote:
> 
> This makes write_ref_sha1() more careful: it actually checks the SHA1 of 
> the ref it is updating, and refuses to update a ref with an object that it 
> cannot find.
Side note: this breaks some tests, because those tests do things like
	git update-ref refs/heads/master 1111111111111111111111111111111111111111 &&
		test 1111111111111111111111111111111111111111 = $(cat .git/refs/heads/master)

which obviously won't work. I didn't update the tests, because I'm an evil person who just finds it very onerous to touch tests, and I particularly hate tests that turn out to be wrong.

(Pet peeve on mine: people fixing assert()'s by changing the source-code, without ever asking themselves whether maybe the assert itself was the bug).

		Linus
Previous: Linus TorvaldsNext: Junio C Hamano
Message 2 of 23 in “Be more careful about updating refs”
  1. Linus TorvaldsJan 15, 2008
  2. Linus TorvaldsJan 16, 2008
  3. Junio C HamanoJan 16, 2008
  4. Charles BaileyJan 17, 2008
  5. Johannes SixtJan 17, 2008
  6. Charles BaileyJan 17, 2008
  7. Johannes SixtJan 17, 2008
  8. Johannes SchindelinJan 17, 2008
  9. Charles BaileyJan 17, 2008
  10. Junio C HamanoJan 18, 2008
  11. Junio C HamanoJan 18, 2008
  12. Shawn O. PearceJan 18, 2008
  13. Junio C HamanoJan 18, 2008
  14. Shawn O. PearceJan 18, 2008
  15. Shawn O. PearceJan 18, 2008
  16. Shawn O. PearceJan 18, 2008
  17. Shawn O. PearceJan 18, 2008
  18. Shawn O. PearceJan 18, 2008
  19. Charles BaileyJan 17, 2008
  20. Junio C HamanoJan 16, 2008
  21. Linus TorvaldsJan 16, 2008
  22. Junio C HamanoJan 16, 2008
  23. Sam VilainJan 23, 2008

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.