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

mktree: multiple same-named objects

From
David Turner <dturner@twopensource.com>
Date
Aug 27, 2014, 04:41 UTC
Message-ID
<1409114517.13351.6.camel@leckie>

git mktree seems to allow the creation of a tree object with multiple objects of the same name but different SHAs. This leads to weird behavior later, unsurprisingly. For instance, if there are two tree objects with the same name but different SHAs, the checked out tree will be the union of them (reasonably), but if you do git add $name, some or all unmodified files under $name will show up in git status as modified -- since they differ from one of the parent trees, presumably.

And if different git implementations treat this case differently, then it might be possible to make a repo that appears to contain one thing when viewed with one implementation, but contains a different thing for a different implementation.

Summary: git mktree ought to forbid this, and possibly there ought to be
other checks (for instance, when unpacking) to prevent this.
Next: Duy Nguyen
Message 1 of 6 in “mktree: multiple same-named objects”
  1. David TurnerAug 27, 2014
  2. Duy NguyenAug 27, 2014
  3. David TurnerAug 27, 2014
  4. Jeff KingAug 27, 2014
  5. Junio C HamanoAug 27, 2014
  6. Jeff KingAug 27, 2014

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.