Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot apply Git patch (replacing a file with a link)

Tags:

git

In a Git repository I would like to replace an existing file with a soft link to a file outside the repository. (Just to make things clear, I want to reference a file automatically generated by an external tool.)

$ git rm FILE
$ ln -s PATH-TO-FILE FILE
$ git add .
$ git commit -m "..."

Everything is cool. I git-format-patch out of this commit - no problem there. But when I attempt to apply this patch ...

$ git am < PATCH
Applying: PATCH
fatal: unrecognized input
Patch failed at 0001 PATCH
...

git-apply produces similar, but less verbose, result.
Is there a way out of this situation ?
Is this behaviour normal at all, or is it a bug ?

Thanks in advance !

like image 456
segfault Avatar asked Nov 11 '22 15:11

segfault


1 Answers

As was pointed out by @janos, this problem does not exist in newer git version.
Indeed, building (the recent) git from source solves the problem, so apparently there was a bug in format-patch.

like image 135
segfault Avatar answered Nov 15 '22 05:11

segfault