Subject: Re: Standardized escaping to store a .git in git?

From: Josh Triplett <[email-masked]>
Date: Wed, 19 May 2021 20:26:52 -0700

On Wed, May 19, 2021 at 03:37:12PM -0700, Jonathan Nieder wrote:
> Josh Triplett wrote:
> > Part of my motivation, here, is that I'm looking to implement one such
> > escaping mechanism (in a tool built atop libgit2 that needs to handle
> > and version arbitrary files), and rather than inventing something
> > bespoke I'd love to interoperate. And since I've seen various approaches
> > used in the wild, I didn't want to add Yet Another distinct approach
> > before starting a design conversation about it.
>
> *nod* To be clear, I'm glad you brought it up, among other reasons
> because it means this discussion becomes available in the list archive
> for when people are wondering about the same thing in the future.
>
> > For the storing-arbitrary-files case, these wouldn't apply.
>
> Can you say a little more about the storing-arbitrary-files case?

Sure. I'm using git to record before-and-after states of running
commands in an isolated environment, to see the differences caused by
those commands. The "before" state includes everything the command
needs, and the delta from "before" to "after" is exactly what the
command changed. Some commands create git repositories; for instance,
some software build scripts `git clone` their dependencies or other
data. So when I go to record the "after" state, it might include a .git
directory. And I need to record that as transparently as possible.

I'd like to use git repositories so that people *can* push and pull
data using git, inspect the repository with things like "git show", use
"git diff", and similar.

> There are some other filenames that "git fsck" also forbids, so this
> comes down to more than figuring out how to handle ".git".

Are you talking about the case-insensitive check for paths that can be
confused with .git on some platforms, or something more than that?