开发者

`git-p4 clone` fails "new tip ... does not contain ..."

I'm runnining on Windows, with the windows p4 client, and git installed via Cygwin. The p4 client advertises how its syntax is regular across platforms and all that, so that should be hunky-dory.

So when I go to git-p4 clone --verbose //depot/path/to/source, it lists out all the files in the repository as though they were being checked out, then dies saying

Exception: fast-import failed: warning: Not updating refs/remotes/p4/master (new tip cd601b92da8625c90af05685e450e55b6d19c9e9 doe开发者_JAVA技巧s not contain 3a512c9408e3cbeef 94c78dfd7115f81e4a6fd0d)

and concludes with a big block of "git-fast-import statistics". Looking at the error: new tip? Huh? What needs to contain it?

What I'm left with is a .git repo that's a couple of megs (much, much smaller than the full source tree would be). Any ideas?


I've had a similar problem and can usually be traced to the casing in paths, branch names, etc. Not sure about P4 but ensure that you don't have a Master branch - it should be master. Follow the same regiment across the board. Also, avoid directory and file names with spaces in them. A lot of git-centric tooling does not like that. Gitolite is one example. It will not allow a repository that has a space in it.


Do you get "Ignoring revision XYZ as it would produce an empty commit" for the very first CL to be imported?

If so, you're hitting a bug in git-p4.py where it clears the "initialParent" setting (necessary so that git fast-import can join the new commits up to the previous import) before it actually commits anything. The new stream of imported files are therefore left unconnected to the old.

I'm currently working around this by using --changesfile and working out explicitly which CL's need to be imported.


Similar to the accepted answer, I had this same problem when trying to sync to a git branch in the form:

git p4 sync --branch=feature/f1 //depot/path/to/code

The / in the branch name appeared to cause the same cryptic fast-import failed warning. Unfortunately git-p4 doesn't seem to support standard git-flow branch names.

Changing to a branch like this worked:

git p4 sync --branch=f1 //depot/path/to/code


I also encountered the "new tip x does not contain y" error running fast-import.

In my case, this was caused by an unrelated preexisting commit in the master branch of the repo I was attempting to import into. I had initialized the repo with the GitHub client which added an initial commit (to add a .gitignore file). The fast-import tool presumably could not reconcile the imported commits with the current state of the branch since the GitHub tool's commit had no relationship with the commits being imported.

The solution for me was to instead initialize an empty repo with "git init" and then run fast-import.


I had similar problems. What worked for me was updating the git-p4 python code. You can take a look at the commit here, but hopefully it will be pulled up soon.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜