segfault
segfault

Reputation: 519

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

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 !

Upvotes: 5

Views: 5166

Answers (2)

segfault
segfault

Reputation: 519

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.

Upvotes: 1

user3021843
user3021843

Reputation: 454

Try without the <:

git am PATCH

I was able to add symbolic link in this way.

Upvotes: 0

Related Questions