Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "flobee.code" <flobee.code@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: gitmodulesSymlink .gitmodules is a symbolic link
Date: Thu, 16 Nov 2023 15:27:18 -0500	[thread overview]
Message-ID: <20231116202718.GD1146561@coredump.intra.peff.net> (raw)
In-Reply-To: <CAM30mqasEjEBbn1vSUwvKP6LLjAFSw3xoeLrB1zLWnH37Z2fUg@mail.gmail.com>

On Wed, Nov 15, 2023 at 05:01:10PM +0100, flobee.code wrote:

> But in general I think the exclusion of symlinks to git system files
> is a mistake. It is implemented too sweepingly in my eyes.

I agree that the fact that we reject these at such a low level makes it
hard to use the tooling to rewrite the history to fix it.

But because of the security implications of out-of-tree symlinks from
untrusted repositories, it's important to catch these consistently. I
see your use case is for in-tree links, but detecting that makes the
checks much more complex. It also has always been the case that symlinks
do not behave consistently, as Git does not follow them when reading
in-index versions of meta files.

> And `git` itself also aborts. So I can't solve the problems this way.
> 
>     git filter-branch --tree-filter 'rm -f .gitmodules' HEAD
>     Rewrite [SomeHash] (3/185) (0 seconds passed, remaining 0 predicted) \
>         error: Invalid path '.gitmodules' Could not initialize the index

I didn't test, but you could probably get by with using "git replace" to
first fix up the offending trees, and then run filter-branch (though
there may be a lot of such trees, so you'd probably to script that
step). I also suspect that filter-repo would handle this better:

  https://github.com/newren/git-filter-repo

but didn't try it myself.

-Peff

      reply	other threads:[~2023-11-16 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 16:01 gitmodulesSymlink .gitmodules is a symbolic link flobee.code
2023-11-16 20:27 ` Jeff King [this message]

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=20231116202718.GD1146561@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=flobee.code@gmail.com \
    --cc=git@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox