[BUG] git-rebase fails when a commit message contains a diff
- From
Jonas Fonseca <fonseca@diku.dk>
- Date
- Nov 9, 2007, 01:12 UTC
- Message-ID
- <20071109011214.GA5903@diku.dk>
I have concocted a test that illustrates the problem: patch below. The problem is that the patches in .dotest are not properly formatted to make it easy to distinguish commit message from commit diff.
When running the test git-rebase fails with:
Applying Test message with diff in it error: config: does not exist in index fatal: sha1 information is lacking or useless (config). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0004.
By modifying the test below, a similar problem related with handling of the end-of-message marker (---\n) can be exposed. A commit message that contains this marker and text afterwards ends up only having the text preceeding the marker.
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 95e33b5..75babdb 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -83,4 +83,25 @@ test_expect_success 'rebase a single mode change' ' GIT_TRACE=1 git rebase master ' +cat >commitdiff-message <<EOF +Test message with diff in it + +--- .git/config 2007-11-02 22:44:55.000000000 +0100 ++++ .git/config+ 2007-11-09 01:40:30.000000000 +0100 +@@ -1,3 +1,4 @@ ++# Broken + [core] + repositoryformatversion = 0 + filemode = true +EOF + +test_expect_success 'rebase commit with diff in the commit message' \ +' + git checkout -b diff-msg upstream-merged-nonlinear && + echo 1 > W && + git add W && + git commit -F commitdiff-message && + git rebase master +' + test_done
-- Jonas Fonseca