5

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
...

eric
  • 140
  • 2
  • 12
  • "just could not apply" doesn't mean anything. What actually happens? – melpomene Sep 14 '15 at 05:43
  • Could you show us an example of one of these patches and what command you're using to apply it? – Schwern Sep 14 '15 at 05:50
  • Yes, sure, it is a linux kernel patch, I paste the full content: – eric Sep 14 '15 at 06:32
  • When using git am: eric@eric-station:/media/ext-data-4/sub-1A_M_0906/kernel$ git am ~/../ext-data-2/daily/2015/0914/v4l2.patch Applying: media: : Add temp raw bayer formats error: patch failed: include/uapi/linux/videodev2.h:607 error: include/uapi/linux/videodev2.h: patch does not apply Patch failed at 0001 media: : Add temp raw bayer formats ... – eric Sep 14 '15 at 06:53
  • When using git am -3 eric@eric-station:/media/ext-data-4/sub-1A_M_0906/kernel$ git am -3 ~/../ext-data-2/daily/2015/0914/v4l2.patch Applying: media: : Add temp raw bayer formats fatal: sha1 information is lacking or useless (include/uapi/linux/videodev2.h). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge ... – eric Sep 14 '15 at 06:53
  • When using patch: eric@eric-station:/media/ext-data-4/sub-1A_M_0906/kernel$ patch -p1 < ~/../ext-data-2/daily/2015/0914/v4l2.patch patching file include/uapi/linux/videodev2.h Hunk #1 succeeded at 535 with fuzz 2 (offset -72 lines). – eric Sep 14 '15 at 06:53

0 Answers0