Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git fast-export format and spaces

Tags:

git

plasticscm

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?

like image 630
pablo Avatar asked Nov 06 '22 04:11

pablo


1 Answers

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).

like image 110
VonC Avatar answered Nov 15 '22 04:11

VonC