From: Jonathan Nieder <jrnieder@gmail.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: git@vger.kernel.org
Subject: Re: Standardized escaping to store a .git in git?
Date: Wed, 19 May 2021 14:31:00 -0700 [thread overview]
Message-ID: <YKWDlF59jWoyE+xJ@google.com> (raw)
In-Reply-To: <YKV8hEAxIzolnROX@localhost>
Hi Josh,
Josh Triplett wrote:
> On rare occasions, a project may need to store and version a .git
> directory in a git repository. For instance, a project that interacts
> with git repositories may need test cases. Or, a project using git to
> store backups may also want to back up git repositories. `.git` is the
> only filename that git can't transparently store and version.
My take on this might be a bit surprising, but it's probably worth
spelling out anyway: Git is first and foremost a source code
management tool, and ".git" directories are not a good interchange
format, so while I have sympathy for this use case, I do _not_ think
that Git should make changes that hurt other use cases in order to
support it.
Instead, I recommend doing one of the following, in order from most to
least preferred:
1. Make the test case run git commands to create a Git repository.
This makes it obvious what the test is trying to do, without
having to deal with unrelated details also recorded in ".git".
This is what Git's test suite does, for example.
2. Check in a fast-import file and use "git fast-import" to make a
Git repository out of it.
3. Check in a "git bundle" file and use "git clone" to make a Git
repository out of it.
4. Check in an archive file (e.g., tar) containing a .git directory.
(I consider this preferable over checking in a .git directory
directly because it prevents a user from accidentally "cd"-ing
into it and running git commands within the checked-in repository
that they intended to run in the top-level repository. That seems
especially worth preventing because the checked-in repository can
contain git aliases and other settings such as core.pager that
cause automatic code execution, as you mentioned.)
Thanks and hope that helps,
Jonathan
next prev parent reply other threads:[~2021-05-19 21:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 21:00 Standardized escaping to store a .git in git? Josh Triplett
2021-05-19 21:31 ` Jonathan Nieder [this message]
2021-05-19 22:08 ` Josh Triplett
2021-05-19 22:37 ` Jonathan Nieder
2021-05-20 3:26 ` Josh Triplett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKWDlF59jWoyE+xJ@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=josh@joshtriplett.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.