am --rebasing: get patch body from commit, not from mailbox
commita230949409f4a650c6a1a9a5879e2a8b993ba695
authorMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Tue, 26 Jun 2012 14:51:56 +0000 (26 07:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Jun 2012 20:17:56 +0000 (26 13:17 -0700)
treeb367408f8d3f6aa62807b6303552e633704b27c5
parentf2b6a19907ccb366790c7ec7b640f9111ac7ad32
am --rebasing: get patch body from commit, not from mailbox

Rebasing a commit that contains a diff in the commit message results
in a failure with output such as

  First, rewinding head to replay your work on top of it...
  Applying: My cool patch.
  fatal: sha1 information is lacking or useless
  (app/controllers/settings_controller.rb).
  Repository lacks necessary blobs to fall back on 3-way merge.
  Cannot fall back to three-way merge.
  Patch failed at 0001 My cool patch.

The reason is that 'git rebase' without -p/-i/-m internally calls 'git
format-patch' and pipes the output to 'git am --rebasing', which has
no way of knowing what is a real patch and what is a commit message
that contains a patch.

Make 'git am' while in --rebasing mode get the patch body from the
commit object instead of extracting it from the mailbox.

Patch by Junio, test case and commit log message by Martin.

Reported-by: anikey <arty.anikey@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh
t/t3405-rebase-malformed.sh