path: root/
diff options
authorMartin von Zweigbergk <>2012-06-26 14:51:56 (GMT)
committerJunio C Hamano <>2012-06-26 20:17:56 (GMT)
commita230949409f4a650c6a1a9a5879e2a8b993ba695 (patch)
treeb367408f8d3f6aa62807b6303552e633704b27c5 /
parentf2b6a19907ccb366790c7ec7b640f9111ac7ad32 (diff)
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 <> Helped-by: Junio C Hamano <> Signed-off-by: Martin von Zweigbergk <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to '')
1 files changed, 1 insertions, 0 deletions
diff --git a/ b/
index f8b7a0c..ec8fde1 100755
--- a/
+++ b/
@@ -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"
sed -n '/^Subject/ s/Subject: //p' "$dotest/info"