{"thread":{"id":"4642","subject":"[PATCH] git-commit: filter out log message lines only when editor was run.","startedAt":"2006-06-23T22:04:05Z","lastAt":"2006-06-24T00:21:12Z","messageCount":2,"participants":["Yann Dirson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22375","messageId":"20060623220405.1915.28636.stgit@gandelf.nowhere.earth","threadId":"4642","inReplyTo":null,"subject":"[PATCH] git-commit: filter out log message lines only when editor was run.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-06-23T22:04:05Z","receivedAt":"2006-06-23T22:04:05Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nThe current behaviour strips out lines starting with a # even when fed\nthrough stdin or -m.  This is particularly bad when importing history from\nanother SCM (tailor 0.9.23 uses git-commit).  In the best cases all lines\nare stripped and the commit fails with a confusing \"empty log message\"\nerror, but in many cases the commit is done, with loss of information.\n\nNote that it is quite peculiar to just have \"#\" handled as a leading\ncomment char here.  One commonly meet CVS: or CG: or STG: as prefixes, and\nusing GIT: would be more robust as well as consistent with other commit\ntools.  However, that would break any tool relying on the # (if any).\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n git-commit.sh |   19 ++++++++++++-------\n 1 files changed, 12 insertions(+), 7 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 6dd04fd..aa3b1ea 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -691,13 +691,18 @@ t)\n \tfi\n esac\n \n-sed -e '\n-    /^diff --git a\\/.*/{\n-\ts///\n-\tq\n-    }\n-    /^#/d\n-' \"$GIT_DIR\"/COMMIT_EDITMSG |\n+if test -z \"$no_edit\"\n+then\n+    sed -e '\n+        /^diff --git a\\/.*/{\n+\t    s///\n+\t    q\n+\t}\n+\t/^#/d\n+    ' \"$GIT_DIR\"/COMMIT_EDITMSG\n+else\n+    cat \"$GIT_DIR\"/COMMIT_EDITMSG\n+fi |\n git-stripspace >\"$GIT_DIR\"/COMMIT_MSG\n \n if cnt=`grep -v -i '^Signed-off-by' \"$GIT_DIR\"/COMMIT_MSG |\n"},{"id":"22394","messageId":"7vveqr769z.fsf@assigned-by-dhcp.cox.net","threadId":"4642","inReplyTo":"20060623220405.1915.28636.stgit@gandelf.nowhere.earth","subject":"Re: [PATCH] git-commit: filter out log message lines only when editor was run.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-24T00:21:12Z","receivedAt":"2006-06-24T00:21:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yann Dirson <ydirson@altern.org> writes:\n\n> The current behaviour strips out lines starting with a # even when fed\n> through stdin or -m.  This is particularly bad when importing history from\n> another SCM (tailor 0.9.23 uses git-commit).  In the best cases all lines\n> are stripped and the commit fails with a confusing \"empty log message\"\n> error, but in many cases the commit is done, with loss of information.\n\nI agree with this in principle but we would need to make sure\nthat our own scripts do not expect that the message is cleaned\nup when feeding a commit log message via stdin, -m or -F, and if\nthey do fix them before applying this patch.\n \n"}]}