On Mon, Oct 10, 2016 at 10:38:45AM +0900, Osamu Aoki wrote:
...
> commit refs/heads/test_ticket_d17d6e5b17
> mark :37455
> committer jan.nijtmans <jan.nijtmans> 1353531216 +0000
> data 82
> Just commit some weird filenames, even one with a newline in it, to
                                                    ^^^^^^^
> test the code.
  ^^^^^^^^^^^^^

Now I realize.

> from :37577
> M 100644 :1050 :abc
> M 100644 :37588 abc
> def.txt

I see this should have been "abc\ndef.txt" instead of "abc", real NL
and "def.txt".

I tested "git fast-export" with filename with NL in it.

| commit refs/heads/master
| mark :4
| author Osamu Aoki <os...@debian.org> 1476073435 +0900
| committer Osamu Aoki <os...@debian.org> 1476073435 +0900
| data 7
| update
| from :2
| M 100644 :3 "foo\nbar.txt"

It generate file like this.  So when ever you see NL, this escaping
needs to happen and they are always double quoted (normally there are no
double quote).  Quick check indicates:

NL     QUOTED "\n"
TAB    QUOTED "\t"
\      QUOTED "\\"
SPACE  QUOTED " "

For example
| M 100644 :8 "space space.txt"

"fossil export" and "fossil import" need to support these features.

As I read git-ls-files manpage, its OUTPUT has following content:

     When -z option is not used, TAB, LF, and backslash characters in
     pathnames are represented as \t, \n, and \\, respectively.

So at least addressing above 4 cases should do good.

  if filename_has_specials(filenamestring)
    filenamestring = quote_and_escape(filenamestring);

Osamu

PS: Immediately after posing here, I got many replies from SPAM :-(
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to