git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* fast-import should fail on invalid unsupported paths
@ 2019-03-18 17:28 Björn Kautler
  2019-03-18 21:17 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Björn Kautler @ 2019-03-18 17:28 UTC (permalink / raw)
  To: git

Hi,

with this simple recipe, you get a non-usable repository:

mkdir foo
cd foo
git init --bare repo
cd repo
git fast-import <<"EOM"
commit refs/heads/master
committer <foo@bar.baz> 0 +0000
data 3
foo
M 644 inline foo/.git/bar
data 3
baz
EOM
cd ..
git clone repo worktree

This actually happened when a user tried to port an SVN repository to
a Git repository and had ".git" paths in the SVN repository.
Using KDEs svn2git utility fast-import accepted the invalid path, but
then when trying to checkout during the clone operation, you get the
error message

Cloning into 'worktree'...
done.
error: Invalid path 'foo/.git/bar'

and the worktree stays empty.

I think fast-import should refuse to import paths Git cannot handle
properly later on, so that the migration fails early and the frontend
that generates the fast-import stream can be fixed / configured to not
include such invalid paths.

Regards
Björn

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fast-import should fail on invalid unsupported paths
  2019-03-18 17:28 fast-import should fail on invalid unsupported paths Björn Kautler
@ 2019-03-18 21:17 ` Jeff King
  2023-04-14 11:54   ` Björn Kautler
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2019-03-18 21:17 UTC (permalink / raw)
  To: Björn Kautler; +Cc: git

On Mon, Mar 18, 2019 at 06:28:16PM +0100, Björn Kautler wrote:

> I think fast-import should refuse to import paths Git cannot handle
> properly later on, so that the migration fails early and the frontend
> that generates the fast-import stream can be fixed / configured to not
> include such invalid paths.

Yeah, that seems quite sensible to me[1].

If you (or anybody else) are interested in working on this, I suspect
the answer is to just sprinkle some calls to verify_path() in the right
spots. Probably in fast-import.c:file_change_m(), etc.

-Peff

[1] Stretching to think of a way this might backfire, I guess somebody
    could be using Git as an intermediate format to then convert to
    another system. But that seems terribly obscure, and at most I think
    we should give that case an escape hatch to disable the check; it
    should definitely be on by default.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fast-import should fail on invalid unsupported paths
  2019-03-18 21:17 ` Jeff King
@ 2023-04-14 11:54   ` Björn Kautler
  0 siblings, 0 replies; 3+ messages in thread
From: Björn Kautler @ 2023-04-14 11:54 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi,

I just want to note that this is still reproducible using 2.40.0. :-)

Regards
Björn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-19  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-18 17:28 fast-import should fail on invalid unsupported paths Björn Kautler
2019-03-18 21:17 ` Jeff King
2023-04-14 11:54   ` Björn Kautler

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).