Git apply patch fails silently (no errors but nothing happens)

gitmsysgitpatch

I'm trying to apply a patch, and git apply patch doesn't give me any errors:

sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)
$ git apply ../../commit-d0d9477

sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)
$

As you can see, no error messages are given. But when I open the history, nothing is committed, and the index is empty. It's as if I haven't issued the git apply command.

I'm at a loss how to troubleshoot this, since there no errors to Google.

Edit: I forgot to say, but I'm trying to transplant my patches from a repository of Tesseract, where I got the source without version control, created my own empty git repo, and made some commits. Later I cloned the Tesseract repository using git svn, and now I'm trying to move my patches there.

Best Answer

I found this while googling for the issue: http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository

git apply will fail to do anything when used within a local checkout of a git repository (other than the one for the project the patch is made for), such as if you are patching a module that is within a site that is in Git version control.

Use patch -p1 < path/file.patch instead.