{"thread":{"id":"527","subject":"[PATCH Cogito] Make use of external editor work like CVS","startedAt":"2005-05-08T01:10:54Z","lastAt":"2005-05-08T01:10:54Z","messageCount":1,"participants":["Marcel Holtmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2760","messageId":"1115514654.9031.45.camel@pegasus","threadId":"527","inReplyTo":null,"subject":"[PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T01:10:54Z","receivedAt":"2005-05-08T01:10:54Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\nI like to extend the work from Pavel and make the cg-commit really work\nlike we know it from CVS. Please consider applying the attached patch.\n\nRegards\n\nMarcel\n\n\n\nMake use of external editor work like CVS\n\nThe lines starting with `CG:' should be a trailer and not at the top\nof the message presented in the editor. Also extend the number of `-'\nup to 74 characters so that people know when they should start a new\nline. If it's not a merge and no commit text is given via the command\nline add an extra empty line at the top.\n\nSigned-off-by: Marcel Holtmann <marcel@holtmann.org>\n\n---\ncommit ad5cabd7130fc180aed0c364d4014abb49f374b0\ntree ca866565063dcd89204e747e8aa0fcb483d14841\nparent 09f6584daa060eda641a8e727698f935e0960e9c\nauthor Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 03:03:53 +0200\ncommitter Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 03:03:53 +0200\n\n cg-commit |   55 +++++++++++++++++++++++++++++++------------------------\n 1 files changed, 31 insertions(+), 24 deletions(-)\n\nIndex: cg-commit\n===================================================================\n--- 5d7e8450d626a4e99f8222378a6818d03a797864/cg-commit  (mode:100755)\n+++ ca866565063dcd89204e747e8aa0fcb483d14841/cg-commit  (mode:100755)\n@@ -61,24 +61,9 @@\n \n LOGMSG=$(mktemp -t gitci.XXXXXX)\n LOGMSG2=$(mktemp -t gitci2.XXXXXX)\n-echo CG: ---------------------------------------------------------- >>$LOGMSG\n-echo CG: Lines beggining with CG: will be automatically removed     >>$LOGMSG\n-echo CG:                                                            >>$LOGMSG\n-if [ ! \"$ignorecache\" ]; then\n-\tif [ ! \"${commitfiles[*]}\" ]; then\n-\t\techo 'Nothing to commit.' >&2\n-\t\texit 2\n-\tfi\n-\tfor file in \"${commitfiles[@]}\"; do\n-\t\t# Prepend a letter describing whether it's addition,\n-\t\t# removal or update. Or call git status on those files.\n-\t\techo CG: $file >>$LOGMSG\n-\tdone\n-\techo CG: >>$LOGMSG\n-fi\n \n if [ \"$merging\" ]; then\n-\techo -n 'Merge with ' >>$LOGMSG\n+\techo -n \"Merge with \" >>$LOGMSG\n \t[ -s .git/merging-sym ] || cp .git/merging .git/merging-sym\n \tfor sym in $(cat .git/merging-sym); do\n \t\turi=$(cat .git/branches/$sym)\n@@ -86,28 +71,50 @@\n \t\techo \"$uri\" >>$LOGMSG\n \t\techo \"$uri\"\n \tdone\n-\techo >>$LOGMSG\n+else\n+\tfirst=1\n fi\n-first=1\n+\n for msg in \"${msgs[@]}\"; do\n \tif [ \"$first\" ]; then\n \t\tfirst=\n \telse\n \t\techo >>$LOGMSG\n \tfi\n-\techo $msg | fmt >>$LOGMSG\n+\techo $msg | fmt -s -w 74 >>$LOGMSG\n done\n+\n+if [ \"$first\" ]; then\n+\techo >>$LOGMSG\n+fi\n+\n+echo \"CG: ----------------------------------------------------------------------\" >>$LOGMSG\n+echo \"CG: Enter Log.  Lines beginning with \\`CG:' are removed automatically\"      >>$LOGMSG\n+if [ ! \"$ignorecache\" ]; then\n+\tif [ ! \"${commitfiles[*]}\" ]; then\n+\t\tdie 'Nothing to commit.'\n+\tfi\n+\techo \"CG: \" >>$LOGMSG\n+\techo \"CG: Modified Files:\" >>$LOGMSG\n+\tfor file in \"${commitfiles[@]}\"; do\n+\t\t# Prepend a letter describing whether it's addition,\n+\t\t# removal or update. Or call git status on those files.\n+\t\techo \"CG:    $file\" >>$LOGMSG\n+\tdone\n+fi\n+echo \"CG: ----------------------------------------------------------------------\" >>$LOGMSG\n+\n cp $LOGMSG $LOGMSG2\n if tty -s; then\n \tif ! [ \"$msgs\" ]; then\n-\t\t${EDITOR:-vi} $LOGMSG2\n-\t\t[ $LOGMSG2 -nt $LOGMSG ] || die 'Commit message not modified, commit aborted'\n+\t\t${EDITOR:-vi} $LOGMSG\n+\t\t[ $LOGMSG -nt $LOGMSG2 ] || die 'Commit message not modified, commit aborted.'\n \tfi\n else\n-\tcat >>$LOGMSG2\n+\tcat >>$LOGMSG\n fi\n-grep -v ^CG: $LOGMSG2 >$LOGMSG\n-rm $LOGMSG2\n+grep -v ^CG: $LOGMSG >$LOGMSG2\n+mv $LOGMSG2 $LOGMSG\n \n if [ ! \"$ignorecache\" ]; then\n \tif [ \"$customfiles\" ]; then\n"}]}