Skip to content
  • Martin von Zweigbergk's avatar
    am --rebasing: get patch body from commit, not from mailbox · a2309494
    Martin von Zweigbergk authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avataranikey <arty.anikey@gmail.com>
    Helped-by: default avatarJunio C Hamano <gitster@pobox.com>
    Signed-off-by: default avatarMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    a2309494