git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Git Mailing List <git@vger.kernel.org>
Subject: git-fast-import doc problem and git-fast-export does not quote filenames correctly
Date: Sat, 04 Sep 2010 08:17:05 +0200	[thread overview]
Message-ID: <4C81E461.7010704@alum.mit.edu> (raw)

According to the git-fast-import manpage:

> A `<path>` string must use UNIX-style directory separators (forward
> slash `/`), may contain any byte other than `LF`, and must not
> start with double quote (`"`).
> 
> If an `LF` or double quote must be encoded into `<path>` shell-style
> quoting should be used, e.g. `"path/with\n and \" in it"`.
> 
> The value of `<path>` must be in canonical form. That is it must not:
> 
> * contain an empty directory component (e.g. `foo//bar` is invalid),
> * end with a directory separator (e.g. `foo/` is invalid),
> * start with a directory separator (e.g. `/foo` is invalid),
> * contain the special component `.` or `..` (e.g. `foo/./bar` and
>   `foo/../bar` are invalid).
> 
> It is recommended that `<path>` always be encoded using UTF-8.

The first problem is that the doc seems to allow NUL bytes (which I
suspect are not really allowed) or the backslash '\' character (which,
if allowed, would logically have to be escaped, too).

The second problem is that "git fast-export" does not do even the
specified quoting:

$ git init
Initialized empty Git repository in /home/mhagger/tmp/gitfoo/.git/
$ touch '"path with
 and " in it"'
$ git add -u
$ git commit -am 'Madness'
[master (root-commit) 2472bdb] Madness
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 "\"path with\n and \" in it\""
$ git fast-export --all
blob
mark :1
data 0

reset refs/heads/master
commit refs/heads/master
mark :2
author Michael Haggerty <mhagger@michael.localdomain> 1283580642 +0200
committer Michael Haggerty <mhagger@michael.localdomain> 1283580642 +0200
data 8
Madness
M 100644 :1 "path with
 and " in it"

reset refs/heads/master
from :2

Michael

             reply	other threads:[~2010-09-04  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-04  6:17 Michael Haggerty [this message]
2010-09-04 16:48 ` git-fast-import doc problem and git-fast-export does not quote filenames correctly Sverre Rabbelier
2010-09-04 19:48   ` Michael Haggerty

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=4C81E461.7010704@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --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;
as well as URLs for NNTP newsgroup(s).