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

Re: [PATCH] fsck: warn about '.' and '..' in trees

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Nov 28, 2012, 04:22 UTC
Message-ID
<CACsJy8DQCo9UzDadHJ2dF-eK20tFDTVn_ScwV+T7z-qLDJMytw@mail.gmail.com>
In-Reply-To
<20121128022736.GA3739@sigill.intra.peff.net>
On Wed, Nov 28, 2012 at 9:27 AM, Jeff King <peff@peff.net> wrote:
Show 21 quoted lines
> A tree with meta-paths like '.' or '..' does not work well
> with git; the index will refuse to load it or check it out
> to the filesystem (and even if we did not have that safety,
> it would look like we were overwriting an untracked
> directory). For the same reason, it is difficult to create
> such a tree with regular git.
>
> Let's warn about these dubious entries during fsck, just in
> case somebody has created a bogus tree (and this also lets
> us prevent them from propagating when transfer.fsckObjects
> is set).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I don't think this is happening in the wild, but I did see somebody
> playing around with libgit2 make such a tree (and it is easy to do with
> git-mktree, of course).
>
> Technically one could use git with such a tree as long as you never ever
> checked out the result, but I think it is sufficiently crazy that we
> should probably detect it, just in case.

Can we declare "." and ".." illegal? There's no room for extension in tree objects and I'm thinking of using maybe "." entry as an extension indicator. Not sure if it works, old gits may attempt to checkout "." entries and fail...

-- 
Duy
Previous: Jeff KingNext: Jeff King
Message 2 of 4 in “fsck: warn about '.' and '..' in trees”
  1. fsck: warn about '.' and '..' in treesJeff King, Nov 28, 2012
  2. Nguyen Thai Ngoc DuyNov 28, 2012
  3. Jeff KingNov 28, 2012
  4. Jeff KingNov 28, 2012

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.