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:

  • How to get the last commit ID of a remote repo using curl-like command?
  • Undo a git svn rebase
  • What to do with Github branches that have been merged to upstream?
  • How can I setup git to checkout some files crlf, others lf?
  • git stash equivalents in other revision control systems?
  • Is there a preferred path where I should initialise my Git repo on Mac OS X?
  • 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?

  • Find the branch point of any specific commit
  • Why does “Git help <command>” not launch html help in my browser, like it says it should?
  • How to switch svn repositories using git-svn?
  • How can I ignore whitespace in the NetBeans merge tool
  • How to find git log messages with more than one line?
  • Capistrano release not publishing
  • 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.