I am experiencing the issue for a long time and still don't get solution yet...
The git version is 1.7.9 installed on ubuntu 12.04.
When apply a patch(the patch could be git-formatted from other reposityro) on a git repository:
when using git am: just could not apply
when using git am -3: it prompt as "sha1 information is lacking or useless"
but the patch indeed could be applied using the patch cmd...
Why the git am could not apply the patch?
I got some investigation on it and finally find some clue:
The patch is originally generated in code base 1 as for example:
Base Line 1
Base Line 2
(patch)Add Line 1
(patch)Add Line 2
Base Line 3
Base Line 4
...
When trying to apply to a code base 2 as for example below (one line missing):
Base Line 1
Base Line 3
Base Line 4
...
git am and git am -3 both does not work
While the patch cmd "intelligently" applied the patch as below(also expected):
Base Line 1
(patch)Add Line 1
(patch)Add Line 2
Base Line 3
Base Line 4
...