git fast-export format and spaces

I’m writing a fast-export/fast-import for Plastic SCM but I’m having issues dealing with directories and files containing spaces in their names.

For instance, a git fast-export of something like:

git mv "new directory" "second directory"

ends up being exported as:

D new directory/hello.c
M 100644 :1 second directory/hello.c

Instead of a “move(R) operation. Same happens with a file with spaces in the name.

Is there a way to handle it correctly?
Does it mean that Git can’t handle renames on paths with spaces?

Edited with a real example below:

I’ve something like this on a commit:

  R src/samples/sampledata src/samples/samplebase
* R src/samples/samplebase/Test.Workflow.xml src/samples/samplebase/new/Test.Workflow.xml

and it fails importing saying

fatal: Path src/samples/samplebase/Test.Workflow.xml not in branch

So, I understand it doesn’t support a move of a directory and then a move of a file inside it… It is a little bit weird, isn’t it?

  • git fast-import commit order
  • Can I work with git locally and sync to Plastic SCM server
  • Plastic SCM with git in bitbucket
  • Best way for git two-way synchronization
  • Create fast-export package from Mercurial repository
  • Merging changes in intermediate branches with DVCS
  • dvcs partial merge (git, hg merge tracking)
  • INTEL-XDK and Source/Version control - Is it even supported?
  • One Solution collect form web for “git fast-export format and spaces”

    git fast-import does mention in the “Handling rename” section:

    When importing a renamed file or directory, simply delete the old name(s) and modify the new name(s) during the corresponding commit. Git performs rename detection after-the-fact, rather than explicitly during a commit.

    So your example seems to follow that logic.

    Don’t forget Git doesn’t version directories, only blob (i.e. file content with an associated path).

    To add to your edited question:

    • a move of a directory means, if imported in Git, that the source (directory) will have to be deleted after all the files have been processed (i.e. imported, renamed or not)
    • a move of a file, when imported in Git, is a classic git mv.

    In 2011, The OP has posted a question on the old gmane list.
    And the issue is currently (2017) discussed in Git for Windows (git-for-windows/git issue 908).

    Git Baby is a git and github fan, let's start git clone.