Fossil

View Ticket
Login

View Ticket

Ticket Hash: 4ee4aa5a30733a53b7a8f09295778165dc6a1669
Title: import does not work with file- or directorynames containing whitespace
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2010-12-11 14:53:59
Version Found In: 20b04536d0c9ab0932e719d2a2475dd22c1354d7
Description:
The (awesome!) git import will not cope with file/directory names containing whitespace: for a file only the part before the first space will show. For a directory, a file with a name of the first part of the directory name before whitespace will be created and all files beneath the dir will not show up.

Minimal test case:

# init git repo

$ mkdir gitrepo
$ cd gitrepo/
$ git init
Initialized empty Git repository in /home/dgruber/tmp/gitrepo/.git/

# add a file with name containing whitespace

$ echo 1 > "file with whitespace.txt"
$ git add file\ with\ whitespace.txt 
$ git commit -m "add file"
[master (root-commit) 1cc529c] add file
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file with whitespace.txt

# add a file in a dir with dirname containing whitespace

$ mkdir "dir with whitespace"
$ echo 2 > dir\ with\ whitespace/test.txt
$ git add dir\ with\ whitespace/
$ git commit -m "add file in dir with space"
[master aa8b906] add file in dir with space
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 dir with space/test.txt

# export to fossil

$ ls -l
total 8
drwxr-xr-x 2 dgruber dgruber 4096 Dec 10 19:47 dir with space
-rw-r--r-- 1 dgruber dgruber    2 Dec 10 19:24 file with whitespace.txt
$ git fast-export --all | fossil import --git ../gitrepo.fossil
Rebuilding repository meta-data...
  100.0% complete...
Vacuuming... ok
project-id: 7e7e2a90dcdeabeab0d308296aafad2c2affa22e
server-id:  aba6f411ae5a0919194c1702d6463f679c9f35a9
admin-user: dgruber (password is "0b315a")

# open fossil repo

$ cd ..
$ mkdir fossilrepo
$ cd fossilrepo/
$ fossil open ../gitrepo.fossil 
$ ls -l
total 16
-rw-r--r-- 1 dgruber dgruber    2 Dec 10 19:49 dir
-rw-r--r-- 1 dgruber dgruber    2 Dec 10 19:49 file
-rw-r--r-- 1 dgruber dgruber 7168 Dec 10 19:49 _FOSSIL_
$ fossil timeline
=== 2010-12-10 ===
19:47:58 [42ca8b1dbf] *CURRENT* add file in dir with space (user:
         dgruber@ed.ac.uk tags: master)
19:24:21 [0f24c7282a] add file (user: dgruber@ed.ac.uk tags: master, trunk)

This is on Debian squeeze i386, latest fossil [20b04536d0c9ab0932e719d2a2475dd22c1354d7] built form source.

Cheers, Daniel


anonymous added on 2010-12-10 20:10:25:
Sorry, I forgot:

$ git --version
git version 1.7.2.3

Cheers, Daniel


drh added on 2010-12-11 00:31:03:
If you ever copy or rename a git pathname contains a space, then the git-fast-import transfer format will not be able to deal with that case. This is a limitation in the design of git-fast-import.

But as long as you do not copy or rename files with spaces in their pathnames, git-fast-import and also Fossil should now be able to deal with it, at least as of check-in [4ee4aa5a30733a5].