summaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>2012-06-26 14:51:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-06-26 20:17:56 (GMT)
commita230949409f4a650c6a1a9a5879e2a8b993ba695 (patch)
treeb367408f8d3f6aa62807b6303552e633704b27c5 /git-am.sh
parentf2b6a19907ccb366790c7ec7b640f9111ac7ad32 (diff)
downloadgit-a230949409f4a650c6a1a9a5879e2a8b993ba695.zip
git-a230949409f4a650c6a1a9a5879e2a8b993ba695.tar.gz
git-a230949409f4a650c6a1a9a5879e2a8b993ba695.tar.bz2
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>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-am.sh b/git-am.sh
index f8b7a0c..ec8fde1 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -683,6 +683,7 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
sed -e '1,/^$/d' >"$dotest/msg-clean"
echo "$commit" > "$dotest/original-commit"
get_author_ident_from_commit "$commit" > "$dotest/author-script"
+ git diff-tree --root --binary "$commit" >"$dotest/patch"
else
{
sed -n '/^Subject/ s/Subject: //p' "$dotest/info"