{"thread":{"id":"530","subject":"[PATCH Cogito] Make use of external editor work like CVS","startedAt":"2005-05-08T15:02:30Z","lastAt":"2005-05-09T07:33:33Z","messageCount":20,"participants":["Marcel Holtmann","Sean","Petr Baudis","Edgar Toernig"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2772","messageId":"1115564550.9031.96.camel@pegasus","threadId":"530","inReplyTo":null,"subject":"[PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T15:02:30Z","receivedAt":"2005-05-08T15:02:30Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\nthis is a modified version of my patch that integrates the your latest\nmodifications to cg-commit and also fixes the cleanup of the temporary\nfiles when we abort the operation.\n\nRegards\n\nMarcel\n\n\n\n[PATCH] Make 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 as parameter\nthen add an extra empty line at the top. And don't forget to take\ncare of the temporary files when a commit is unneeded or canceled.\n\nSigned-off-by: Marcel Holtmann <marcel@holtmann.org>\n\n---\ncommit 895bcd02ecc96bed1d35275def6dca1ca6f20e5f\ntree be440e169fa3b5ec5450fa9574cd8789b0e3ab20\nparent 64142a39e7a6701e69654a930de86a9fe296f8a0\nauthor Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 16:58:50 +0200\ncommitter Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 16:58:50 +0200\n\n cg-commit |   63 ++++++++++++++++++++++++++++++++++++--------------------------\n 1 files changed, 37 insertions(+), 26 deletions(-)\n\nIndex: cg-commit\n===================================================================\n--- 8bb38f8bfdc7411460c300c811da1987173f412f/cg-commit  (mode:100755)\n+++ be440e169fa3b5ec5450fa9574cd8789b0e3ab20/cg-commit  (mode:100755)\n@@ -61,26 +61,10 @@\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-\t\t[ \"$msgs\" ] && echo $file\n-\tdone\n-\techo CG: >>$LOGMSG\n-fi\n \n if [ \"$merging\" ]; then\n-\techo -n 'Merge with ' >>$LOGMSG\n-\t[ \"$msgs\" ] && echo -n 'Merge with '\n+\techo -n \"Merge with \" >>$LOGMSG\n+\t[ \"$msgs\" ] && echo -n \"Merge with \"\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@@ -88,28 +72,55 @@\n \t\techo \"$uri\" >>$LOGMSG\n \t\t[ \"$msgs\" ] && echo \"$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\trm $LOGMSG $LOGMSG2\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+\t\t[ \"$msgs\" ] && echo \"$file\"\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\tif [ ! $LOGMSG -nt $LOGMSG2 ]; then\n+\t\t\trm $LOGMSG $LOGMSG2\n+\t\t\tdie 'Commit message not modified, commit aborted.'\n+\t\tfi\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"},{"id":"2773","messageId":"1590.10.10.10.24.1115565892.squirrel@linux1","threadId":"530","inReplyTo":"1115564550.9031.96.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2005-05-08T15:24:52Z","receivedAt":"2005-05-08T15:24:52Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Sun, May 8, 2005 11:02 am, Marcel Holtmann said:\n> Hi Petr,\n>\n> this is a modified version of my patch that integrates the your latest\n> modifications to cg-commit and also fixes the cleanup of the temporary\n> files when we abort the operation.\n>\n\nHi Marcel,\n\nWhat do you think about providing a per-repository commit template?  So,\nif say \".git/commit.form\" exists, use it instead of the default?\n\nAt a minimum, it would be nice to include a reminder about adding a\n\"Signed-off-by:\" line.\n\nSean\n\n\n"},{"id":"2774","messageId":"20050508152529.GU9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115564550.9031.96.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T15:25:29Z","receivedAt":"2005-05-08T15:25:29Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 05:02:30PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Petr,\n\nHi,\n\n> this is a modified version of my patch that integrates the your latest\n> modifications to cg-commit and also fixes the cleanup of the temporary\n> files when we abort the operation.\n\n...and I've just pushed more modifications. I'm so evil.\n\n> [PATCH] Make use of external editor work like CVS\n> \n> The lines starting with `CG:' should be a trailer and not at the top\n> of the message presented in the editor. Also extend the number of `-'\n> up to 74 characters so that people know when they should start a new\n> line. If it's not a merge and no commit text is given as parameter\n> then add an extra empty line at the top. And don't forget to take\n> care of the temporary files when a commit is unneeded or canceled.\n> \n> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>\n\nWhat is so special about 74 columns? Why not 75 (fmt default), or 72\n(emails)?\n\nAlso, I'd prefer the empty line to be always there in front of the CG:\nstuff (two empty lines in case of merge - I want to encourage people to\nkeep possible details w.r.t. the merge separated by an empty line from\nthe merge information), and when reading it back cg-commit should strip\nany trailing empty lines.\n\n> Index: cg-commit\n> ===================================================================\n> --- 8bb38f8bfdc7411460c300c811da1987173f412f/cg-commit  (mode:100755)\n> +++ be440e169fa3b5ec5450fa9574cd8789b0e3ab20/cg-commit  (mode:100755)\n>  if [ \"$merging\" ]; then\n> -\techo -n 'Merge with ' >>$LOGMSG\n> -\t[ \"$msgs\" ] && echo -n 'Merge with '\n> +\techo -n \"Merge with \" >>$LOGMSG\n> +\t[ \"$msgs\" ] && echo -n \"Merge with \"\n\nWe aren't too consistent about this anyway now, so you might as well\nlet it not clutter your patch. ;-)\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\tif [ ! $LOGMSG -nt $LOGMSG2 ]; then\n> +\t\t\trm $LOGMSG $LOGMSG2\n> +\t\t\tdie 'Commit message not modified, commit aborted.'\n> +\t\tfi\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\nWhy are you messing with the $LOGMSG variables here?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2775","messageId":"1115566990.9031.108.camel@pegasus","threadId":"530","inReplyTo":"20050508152529.GU9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T15:43:10Z","receivedAt":"2005-05-08T15:43:10Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > this is a modified version of my patch that integrates the your latest\n> > modifications to cg-commit and also fixes the cleanup of the temporary\n> > files when we abort the operation.\n> \n> ...and I've just pushed more modifications. I'm so evil.\n\nattached is another version of the patch.\n\n> > [PATCH] Make use of external editor work like CVS\n> > \n> > The lines starting with `CG:' should be a trailer and not at the top\n> > of the message presented in the editor. Also extend the number of `-'\n> > up to 74 characters so that people know when they should start a new\n> > line. If it's not a merge and no commit text is given as parameter\n> > then add an extra empty line at the top. And don't forget to take\n> > care of the temporary files when a commit is unneeded or canceled.\n> > \n> > Signed-off-by: Marcel Holtmann <marcel@holtmann.org>\n> \n> What is so special about 74 columns? Why not 75 (fmt default), or 72\n> (emails)?\n\nI ended up with 74, because \"CG\" has only two letters instead of \"CVS\"\nwhich has three. And cg-log uses a prefix of four whitespaces. This\nleaves two free characters at the end of a line if your terminal uses a\nwidth of 80 characters. The decision was of cosmetic nature.\n\n> Also, I'd prefer the empty line to be always there in front of the CG:\n> stuff (two empty lines in case of merge - I want to encourage people to\n> keep possible details w.r.t. the merge separated by an empty line from\n> the merge information), and when reading it back cg-commit should strip\n> any trailing empty lines.\n\nI think we should differentiate between the merges. There is no need for\nadditional information if it is an automatic merge (no conflicts) and in\ngeneral it makes no sense to open the editor (until forced). I wanted to\naddress this later. And yes in case of a manual merge it is a good idea\nto add two extra empty lines at the top.\n\nAnother good idea is maybe to remove empty lines at the top and bottom\nbefore doing the commit.\n\n> > Index: cg-commit\n> > ===================================================================\n> > --- 8bb38f8bfdc7411460c300c811da1987173f412f/cg-commit  (mode:100755)\n> > +++ be440e169fa3b5ec5450fa9574cd8789b0e3ab20/cg-commit  (mode:100755)\n> >  if [ \"$merging\" ]; then\n> > -\techo -n 'Merge with ' >>$LOGMSG\n> > -\t[ \"$msgs\" ] && echo -n 'Merge with '\n> > +\techo -n \"Merge with \" >>$LOGMSG\n> > +\t[ \"$msgs\" ] && echo -n \"Merge with \"\n> \n> We aren't too consistent about this anyway now, so you might as well\n> let it not clutter your patch. ;-)\n\nI was moving parts of the code so I addressed it ;)\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\tif [ ! $LOGMSG -nt $LOGMSG2 ]; then\n> > +\t\t\trm $LOGMSG $LOGMSG2\n> > +\t\t\tdie 'Commit message not modified, commit aborted.'\n> > +\t\tfi\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> Why are you messing with the $LOGMSG variables here?\n\nThis is only cosmetic. Using vim it displays the name of the temporary\nfile and confusing the user with gitci2.XXXX instead of gitci.XXX is\nweird. Even using gitci as basename looks not good to me, but I left it\nfor now.\n\nRegards\n\nMarcel\n\n\n\n[PATCH] Make 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 as parameter\nthen add an extra empty line at the top. And don't forget to take\ncare of the temporary files when a commit is unneeded or canceled.\n\nSigned-off-by: Marcel Holtmann <marcel@holtmann.org>\n\n---\ncommit a2c4e793a4dfb21f43494ad90c7b887df10e1be2\ntree cb61efa8a01400150162af9b0f3773f21d502fe9\nparent 79f86b0174159f016540734ac18560566389b823\nauthor Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 17:30:01 +0200\ncommitter Marcel Holtmann <marcel@holtmann.org> Sun, 08 May 2005 17:30:01 +0200\n\n cg-commit |   61 +++++++++++++++++++++++++++++++++++--------------------------\n 1 files changed, 35 insertions(+), 26 deletions(-)\n\nIndex: cg-commit\n===================================================================\n--- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n+++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n@@ -67,26 +67,10 @@\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-\t\t[ \"$msgs\" ] && echo $file\n-\tdone\n-\techo CG: >>$LOGMSG\n-fi\n \n if [ \"$merging\" ]; then\n-\techo -n 'Merge with ' >>$LOGMSG\n-\t[ \"$msgs\" ] && echo -n 'Merge with '\n+\techo -n \"Merge with \" >>$LOGMSG\n+\t[ \"$msgs\" ] && echo -n \"Merge with \"\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@@ -94,30 +78,55 @@\n \t\techo \"$uri\" >>$LOGMSG\n \t\t[ \"$msgs\" ] && echo \"$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\trm $LOGMSG $LOGMSG2\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+\t\t[ \"$msgs\" ] && echo $file\n+\tdone\n+fi\n+echo \"CG: ----------------------------------------------------------------------\" >>$LOGMSG\n+\n cp $LOGMSG $LOGMSG2\n if tty -s; then\n \tif ! [ \"$msgs\" ] || [ \"$forceeditor\" ]; then\n-\t\t${EDITOR:-vi} $LOGMSG2\n+\t\t${EDITOR:-vi} $LOGMSG\n \tfi\n-\tif ! [ \"$msgs\" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then\n-\t\tdie 'Commit message not modified, commit aborted'\n+\tif ! [ \"$msgs\" ] && ! [ $LOGMSG -nt $LOGMSG2 ]; then\n+\t\trm $LOGMSG $LOGMSG2\n+\t\tdie 'Commit message not modified, commit aborted.'\n \tfi\n else\n \tcat >>$LOGMSG2\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"},{"id":"2776","messageId":"20050508155656.GV9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115566990.9031.108.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T15:56:56Z","receivedAt":"2005-05-08T15:56:56Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 05:43:10PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Petr,\n\nHi,\n\n> > What is so special about 74 columns? Why not 75 (fmt default), or 72\n> > (emails)?\n> \n> I ended up with 74, because \"CG\" has only two letters instead of \"CVS\"\n> which has three. And cg-log uses a prefix of four whitespaces. This\n> leaves two free characters at the end of a line if your terminal uses a\n> width of 80 characters. The decision was of cosmetic nature.\n\nIsn't one free character enough?  I'll just stay with 75. :-)\n\n> > Also, I'd prefer the empty line to be always there in front of the CG:\n> > stuff (two empty lines in case of merge - I want to encourage people to\n> > keep possible details w.r.t. the merge separated by an empty line from\n> > the merge information), and when reading it back cg-commit should strip\n> > any trailing empty lines.\n> \n> I think we should differentiate between the merges. There is no need for\n> additional information if it is an automatic merge (no conflicts) and in\n> general it makes no sense to open the editor (until forced). I wanted to\n> address this later. And yes in case of a manual merge it is a good idea\n> to add two extra empty lines at the top.\n\nNot so. I frequently write a brief summary of what I'm actually merging.\nI'm not forcing you to do so too, but I personally think it's a good\nidea, and want to do it in the future too. :-)\n\n> This is only cosmetic. Using vim it displays the name of the temporary\n> file and confusing the user with gitci2.XXXX instead of gitci.XXX is\n> weird. Even using gitci as basename looks not good to me, but I left it\n> for now.\n\nIt boosts the patch size unnecessarily. It shouldn't be called gitci2\nanyway... :-) Feel free to change the mktemp templates instead.\n\nThe gitci name comes all the way from the times where this command was\nusually triggered by 'git ci'.\n\n> Index: cg-commit\n> ===================================================================\n> --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> @@ -94,30 +78,55 @@\n>  \t\techo \"$uri\" >>$LOGMSG\n>  \t\t[ \"$msgs\" ] && echo \"$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\nThis mess is still here.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2777","messageId":"1115568937.9031.129.camel@pegasus","threadId":"530","inReplyTo":"20050508155656.GV9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T16:15:36Z","receivedAt":"2005-05-08T16:15:36Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > > What is so special about 74 columns? Why not 75 (fmt default), or 72\n> > > (emails)?\n> > \n> > I ended up with 74, because \"CG\" has only two letters instead of \"CVS\"\n> > which has three. And cg-log uses a prefix of four whitespaces. This\n> > leaves two free characters at the end of a line if your terminal uses a\n> > width of 80 characters. The decision was of cosmetic nature.\n> \n> Isn't one free character enough?  I'll just stay with 75. :-)\n\nI think it looks a little bit squeezed, but I don't mind at all. Maybe\nusing 72 is a good idea. However it is only cosmetic and I can change it\nto use the fmt default.\n\n> > > Also, I'd prefer the empty line to be always there in front of the CG:\n> > > stuff (two empty lines in case of merge - I want to encourage people to\n> > > keep possible details w.r.t. the merge separated by an empty line from\n> > > the merge information), and when reading it back cg-commit should strip\n> > > any trailing empty lines.\n> > \n> > I think we should differentiate between the merges. There is no need for\n> > additional information if it is an automatic merge (no conflicts) and in\n> > general it makes no sense to open the editor (until forced). I wanted to\n> > address this later. And yes in case of a manual merge it is a good idea\n> > to add two extra empty lines at the top.\n> \n> Not so. I frequently write a brief summary of what I'm actually merging.\n> I'm not forcing you to do so too, but I personally think it's a good\n> idea, and want to do it in the future too. :-)\n\nWhat do you think about a special flag for automatic merging (which\nmakes the commit message say \"Automatic merge\") and a .cogitorc file\nlike .cvsrc where you can choose the default method.\n\nI am using a lot of temporary trees where I pull a lot of kernel\nsubsystems together and I don't need that \"feature\" there.\n\n> > This is only cosmetic. Using vim it displays the name of the temporary\n> > file and confusing the user with gitci2.XXXX instead of gitci.XXX is\n> > weird. Even using gitci as basename looks not good to me, but I left it\n> > for now.\n> \n> It boosts the patch size unnecessarily. It shouldn't be called gitci2\n> anyway... :-) Feel free to change the mktemp templates instead.\n\nI will check what I can do, but I don't really care that much about the\npatch size ;)\n\n> The gitci name comes all the way from the times where this command was\n> usually triggered by 'git ci'.\n\nI thought so. Is using cogito.XXXXXX and cogito.temp.XXXXX fine with\nyou?\n\n> > Index: cg-commit\n> > ===================================================================\n> > --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> > +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> > @@ -94,30 +78,55 @@\n> >  \t\techo \"$uri\" >>$LOGMSG\n> >  \t\t[ \"$msgs\" ] && echo \"$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> This mess is still here.\n\nThat is not mess. Think about it. If we have messages provided by -m we\nwant an empty line between the merge message and the the first commit\nmessage. And we don't wanna have an extra empty line at the top if you\nprovide a commit messages via -m.\n\nRegards\n\nMarcel\n\n\n"},{"id":"2779","messageId":"20050508171209.GX9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115568937.9031.129.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T17:12:09Z","receivedAt":"2005-05-08T17:12:09Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 06:15:36PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Petr,\n\nHi,\n\n> What do you think about a special flag for automatic merging (which\n> makes the commit message say \"Automatic merge\") and a .cogitorc file\n> like .cvsrc where you can choose the default method.\n> \n> I am using a lot of temporary trees where I pull a lot of kernel\n> subsystems together and I don't need that \"feature\" there.\n\nNo problem with that per se, but please keep the configfile\ninfrastructure and the automerge switch as separate patches from this\none.\n\n> > > This is only cosmetic. Using vim it displays the name of the temporary\n> > > file and confusing the user with gitci2.XXXX instead of gitci.XXX is\n> > > weird. Even using gitci as basename looks not good to me, but I left it\n> > > for now.\n> > \n> > It boosts the patch size unnecessarily. It shouldn't be called gitci2\n> > anyway... :-) Feel free to change the mktemp templates instead.\n> \n> I will check what I can do, but I don't really care that much about the\n> patch size ;)\n\nBut I do. :-)\n\n> > The gitci name comes all the way from the times where this command was\n> > usually triggered by 'git ci'.\n> \n> I thought so. Is using cogito.XXXXXX and cogito.temp.XXXXX fine with\n> you?\n\nNo. I think it's useful (and doesn't cost us anything) to have the\n\"owner\" of the file denoted in the filename.\n\n> > > Index: cg-commit\n> > > ===================================================================\n> > > --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> > > +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> > > @@ -94,30 +78,55 @@\n> > >  \t\techo \"$uri\" >>$LOGMSG\n> > >  \t\t[ \"$msgs\" ] && echo \"$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> > This mess is still here.\n> \n> That is not mess. Think about it. If we have messages provided by -m we\n> want an empty line between the merge message and the the first commit\n> message. And we don't wanna have an extra empty line at the top if you\n> provide a commit messages via -m.\n\nBut, that's the current behaviour, isn't it?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2780","messageId":"1115572667.9031.139.camel@pegasus","threadId":"530","inReplyTo":"20050508171209.GX9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T17:17:47Z","receivedAt":"2005-05-08T17:17:47Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > What do you think about a special flag for automatic merging (which\n> > makes the commit message say \"Automatic merge\") and a .cogitorc file\n> > like .cvsrc where you can choose the default method.\n> > \n> > I am using a lot of temporary trees where I pull a lot of kernel\n> > subsystems together and I don't need that \"feature\" there.\n> \n> No problem with that per se, but please keep the configfile\n> infrastructure and the automerge switch as separate patches from this\n> one.\n\nIt was never part of this patch. It is something I am thinking about.\n\n> > > > This is only cosmetic. Using vim it displays the name of the temporary\n> > > > file and confusing the user with gitci2.XXXX instead of gitci.XXX is\n> > > > weird. Even using gitci as basename looks not good to me, but I left it\n> > > > for now.\n> > > \n> > > It boosts the patch size unnecessarily. It shouldn't be called gitci2\n> > > anyway... :-) Feel free to change the mktemp templates instead.\n> > \n> > I will check what I can do, but I don't really care that much about the\n> > patch size ;)\n> \n> But I do. :-)\n\nSometime you don't have any other choice, because diff is not perfect.\nDo you wanna apply that patch or should I change the mktemp templates\nfirst?\n\n> > > The gitci name comes all the way from the times where this command was\n> > > usually triggered by 'git ci'.\n> > \n> > I thought so. Is using cogito.XXXXXX and cogito.temp.XXXXX fine with\n> > you?\n> \n> No. I think it's useful (and doesn't cost us anything) to have the\n> \"owner\" of the file denoted in the filename.\n> \n> > > > Index: cg-commit\n> > > > ===================================================================\n> > > > --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> > > > +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> > > > @@ -94,30 +78,55 @@\n> > > >  \t\techo \"$uri\" >>$LOGMSG\n> > > >  \t\t[ \"$msgs\" ] && echo \"$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> > > This mess is still here.\n> > \n> > That is not mess. Think about it. If we have messages provided by -m we\n> > want an empty line between the merge message and the the first commit\n> > message. And we don't wanna have an extra empty line at the top if you\n> > provide a commit messages via -m.\n> \n> But, that's the current behaviour, isn't it?\n\nNo it is not, because with my change the messages are at the top and\nbefore the CG: lines.\n\nRegards\n\nMarcel\n\n\n"},{"id":"2786","messageId":"20050508173003.GY9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115572667.9031.139.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T17:30:03Z","receivedAt":"2005-05-08T17:30:03Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 07:17:47PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> > > I will check what I can do, but I don't really care that much about the\n> > > patch size ;)\n> > \n> > But I do. :-)\n> \n> Sometime you don't have any other choice, because diff is not perfect.\n> Do you wanna apply that patch or should I change the mktemp templates\n> first?\n\nIt looks like it'll be most painless when I just reinvent parts of your\npatch here locally and you can send me patches on top of that.\n\n> > > > > Index: cg-commit\n> > > > > ===================================================================\n> > > > > --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> > > > > +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> > > > > @@ -94,30 +78,55 @@\n> > > > >  \t\techo \"$uri\" >>$LOGMSG\n> > > > >  \t\t[ \"$msgs\" ] && echo \"$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> > > > This mess is still here.\n> > > \n> > > That is not mess. Think about it. If we have messages provided by -m we\n> > > want an empty line between the merge message and the the first commit\n> > > message. And we don't wanna have an extra empty line at the top if you\n> > > provide a commit messages via -m.\n> > \n> > But, that's the current behaviour, isn't it?\n> \n> No it is not, because with my change the messages are at the top and\n> before the CG: lines.\n\nI'm sorry but I still don't get what are you trying to say. :-)\nAs far as I can see, the output will be the same, except that with to -m\narguments, there won't be the extra newline for the merge message - and\nwe agreed we want it, didn't we?\n\nI'll just drop this chunk. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2788","messageId":"1115574035.9031.145.camel@pegasus","threadId":"530","inReplyTo":"20050508173003.GY9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T17:40:34Z","receivedAt":"2005-05-08T17:40:34Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > Sometime you don't have any other choice, because diff is not perfect.\n> > Do you wanna apply that patch or should I change the mktemp templates\n> > first?\n> \n> It looks like it'll be most painless when I just reinvent parts of your\n> patch here locally and you can send me patches on top of that.\n\nit is your choice. I can change that if you like. My latest version\nshould apply cleanly against your current tree.\n\n> > > > > > Index: cg-commit\n> > > > > > ===================================================================\n> > > > > > --- f00d7589973e8ea65d2264f5fbac82e1b217dc8f/cg-commit  (mode:100755)\n> > > > > > +++ cb61efa8a01400150162af9b0f3773f21d502fe9/cg-commit  (mode:100755)\n> > > > > > @@ -94,30 +78,55 @@\n> > > > > >  \t\techo \"$uri\" >>$LOGMSG\n> > > > > >  \t\t[ \"$msgs\" ] && echo \"$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> > > > > This mess is still here.\n> > > > \n> > > > That is not mess. Think about it. If we have messages provided by -m we\n> > > > want an empty line between the merge message and the the first commit\n> > > > message. And we don't wanna have an extra empty line at the top if you\n> > > > provide a commit messages via -m.\n> > > \n> > > But, that's the current behaviour, isn't it?\n> > \n> > No it is not, because with my change the messages are at the top and\n> > before the CG: lines.\n> \n> I'm sorry but I still don't get what are you trying to say. :-)\n> As far as I can see, the output will be the same, except that with to -m\n> arguments, there won't be the extra newline for the merge message - and\n> we agreed we want it, didn't we?\n\nThe -m has nothing to do with the merge message. You can have one of\nthem, but also both. Maybe I missed something in your latest changes.\n\nIf you want the extra newline(s) then it is a good idea to add something\nthat strips heading and trailing empty lines from the final commit\nmessage, because otherwise it will be ugly if you don't enter extra text\nfor the merge.\n\nRegards\n\nMarcel\n\n\n"},{"id":"2791","messageId":"20050508175156.GA9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115574035.9031.145.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T17:51:56Z","receivedAt":"2005-05-08T17:51:56Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 07:40:34PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> > > Sometime you don't have any other choice, because diff is not perfect.\n> > > Do you wanna apply that patch or should I change the mktemp templates\n> > > first?\n> > \n> > It looks like it'll be most painless when I just reinvent parts of your\n> > patch here locally and you can send me patches on top of that.\n> \n> it is your choice. I can change that if you like. My latest version\n> should apply cleanly against your current tree.\n\nI've pushed my changes, please have a look at them. I think I've got\neverything important, but I might've forgot something.\n\n> If you want the extra newline(s) then it is a good idea to add something\n> that strips heading and trailing empty lines from the final commit\n> message, because otherwise it will be ugly if you don't enter extra text\n> for the merge.\n\nIsn't that what I initially suggested? :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2793","messageId":"1115578658.8949.9.camel@pegasus","threadId":"530","inReplyTo":"20050508175156.GA9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T18:57:38Z","receivedAt":"2005-05-08T18:57:38Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > > > Sometime you don't have any other choice, because diff is not perfect.\n> > > > Do you wanna apply that patch or should I change the mktemp templates\n> > > > first?\n> > > \n> > > It looks like it'll be most painless when I just reinvent parts of your\n> > > patch here locally and you can send me patches on top of that.\n> > \n> > it is your choice. I can change that if you like. My latest version\n> > should apply cleanly against your current tree.\n> \n> I've pushed my changes, please have a look at them. I think I've got\n> everything important, but I might've forgot something.\n\nlook at the attached patch. We should use \"fmt -s\" to keep newlines that\nare inside the commit message and there is one unneeded empty CG: line.\n\nI also put back in the \"mess\", because if there is no commit message\nprovided via -m it gives us an initial empty line to start in. This is\nthe same that CVS does and it makes the life inside vi a lot more\neasier.\n\nThe change (aka the \"mess\") looks crazy, but play with the different\nsituations and see what it does.\n\n> > If you want the extra newline(s) then it is a good idea to add something\n> > that strips heading and trailing empty lines from the final commit\n> > message, because otherwise it will be ugly if you don't enter extra text\n> > for the merge.\n> \n> Isn't that what I initially suggested? :-)\n\nBut this hasn't been done so far. And I don't know any shell tool for\nthis job, beside some crazy awk or sed stuff. However stripspace.c from\ngit-tools can do this job.\n\nRegards\n\nMarcel\n\n\n\ncg-commit: needs update\nIndex: cg-commit\n===================================================================\n--- 6054af5ea0ef88077ad91131b0411dd10590b863/cg-commit  (mode:100755)\n+++ uncommitted/cg-commit  (mode:100755)\n@@ -80,17 +80,23 @@\n \t\t[ \"$msgs\" ] && echo \"$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 >>$LOGMSG\n done\n \n+if [ \"$first\" ]; then\n+\techo >>$LOGMSG\n+fi\n+\n cat >>$LOGMSG <<EOT\n CG: -----------------------------------------------------------------------\n CG: Lines beginning with the CG: prefix are removed automatically\n@@ -108,7 +114,6 @@\n \t\techo \"CG:    $file\" >>$LOGMSG\n \t\t[ \"$msgs\" ] && echo $file\n \tdone\n-\techo \"CG:\" >>$LOGMSG\n fi\n echo \"CG: -----------------------------------------------------------------------\" >>$LOGMSG\n \n"},{"id":"2812","messageId":"20050508200334.GG9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115578658.8949.9.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T20:03:34Z","receivedAt":"2005-05-08T20:03:34Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 08:57:38PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Petr,\n\nHello,\n\n> look at the attached patch. We should use \"fmt -s\" to keep newlines that\n> are inside the commit message and there is one unneeded empty CG: line.\n\nthanks, fixed and pushed out.\n\n> I also put back in the \"mess\", because if there is no commit message\n> provided via -m it gives us an initial empty line to start in. This is\n> the same that CVS does and it makes the life inside vi a lot more\n> easier.\n\nWell, I use 'O' to start editing. ;-) (Actually, I use the -m arguments\nextensively; the way it is now is how I always dreamt of it since I\nstarted using SCMs. Possibly in conjuction with -e to add some fancy\nstuff.)\n\nYour way might be cunning, fast, or even clever, but it was certainly\nnot clear, therefore not maintainable well. I tried to implement it in a\nsimpler and more clear way. Does it behave as you want now?\n\n> > > If you want the extra newline(s) then it is a good idea to add something\n> > > that strips heading and trailing empty lines from the final commit\n> > > message, because otherwise it will be ugly if you don't enter extra text\n> > > for the merge.\n> > \n> > Isn't that what I initially suggested? :-)\n> \n> But this hasn't been done so far. And I don't know any shell tool for\n> this job, beside some crazy awk or sed stuff. However stripspace.c from\n> git-tools can do this job.\n\n#/bin/sh\n\nleading=1\nemptylines=0\nwhile read line; do\n        if ! [ \"$line\" ]; then\n\t\t[ \"$leading\" ] && continue\n\t\temptylines=$(($emptylines + 1))\n        else\n\t\tleading=0\n                while [ $emptylines -gt 0 ]; do\n                        echo \"\"\n                        emptylines=$(($emptylines - 1))\n                done\n                echo $line\n        fi\ndone\n\nor something? (Based on someone else's script since I was too lazy. ;-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2816","messageId":"1115584015.8949.43.camel@pegasus","threadId":"530","inReplyTo":"20050508200334.GG9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T20:26:55Z","receivedAt":"2005-05-08T20:26:55Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > look at the attached patch. We should use \"fmt -s\" to keep newlines that\n> > are inside the commit message and there is one unneeded empty CG: line.\n> \n> thanks, fixed and pushed out.\n\ncool. Now I have everything I am used to from CVS, but ...\n\n@@ -113,7 +113,9 @@\n                # TODO: Prepend a letter describing whether it's addition,\n                # removal or update. Or call git status on those files.\n                echo \"CG:    $file\" >>$LOGMSG\n-               [ \"$msgs\" ] && echo $file\n+               if [ \"$msgs\" ] && ! [ \"$forceeditor\" ]; then\n+                       echo $file\n+               fi\n        done\n fi\n\nThere is no need to print out the files if we start the editor anyway.\n\n@@ -122,10 +124,10 @@\n if tty -s; then\n        if ! [ \"$msgs\" ] || [ \"$forceeditor\" ]; then\n                ${EDITOR:-vi} $LOGMSG2\n-       fi\n-       if ! [ \"$msgs\" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then\n-               rm $LOGMSG $LOGMSG2\n-               die 'Commit message not modified, commit aborted'\n+               if ! [ $LOGMSG2 -nt $LOGMSG ]; then\n+                       rm $LOGMSG $LOGMSG2\n+                       die 'Commit message not modified, commit aborted'\n+               fi\n        fi\n else\n\nIf you provide a commit message via -m and then close the editor without\nchanging it, it will commit the message. I think that will not be the\nintention of the user.\n\n> > I also put back in the \"mess\", because if there is no commit message\n> > provided via -m it gives us an initial empty line to start in. This is\n> > the same that CVS does and it makes the life inside vi a lot more\n> > easier.\n> \n> Well, I use 'O' to start editing. ;-) (Actually, I use the -m arguments\n> extensively; the way it is now is how I always dreamt of it since I\n> started using SCMs. Possibly in conjuction with -e to add some fancy\n> stuff.)\n> \n> Your way might be cunning, fast, or even clever, but it was certainly\n> not clear, therefore not maintainable well. I tried to implement it in a\n> simpler and more clear way. Does it behave as you want now?\n\nWhat should I say ;)\n\nI will do a little bit more tests, but it looks very good. Besides the\nstuff above.\n\n> > > > If you want the extra newline(s) then it is a good idea to add something\n> > > > that strips heading and trailing empty lines from the final commit\n> > > > message, because otherwise it will be ugly if you don't enter extra text\n> > > > for the merge.\n> > > \n> > > Isn't that what I initially suggested? :-)\n> > \n> > But this hasn't been done so far. And I don't know any shell tool for\n> > this job, beside some crazy awk or sed stuff. However stripspace.c from\n> > git-tools can do this job.\n> \n> #/bin/sh\n> \n> leading=1\n> emptylines=0\n> while read line; do\n>         if ! [ \"$line\" ]; then\n> \t\t[ \"$leading\" ] && continue\n> \t\temptylines=$(($emptylines + 1))\n>         else\n> \t\tleading=0\n>                 while [ $emptylines -gt 0 ]; do\n>                         echo \"\"\n>                         emptylines=$(($emptylines - 1))\n>                 done\n>                 echo $line\n>         fi\n> done\n> \n> or something? (Based on someone else's script since I was too lazy. ;-)\n\nI am not that script expert anymore. I do most stuff in C now and I am\nvery happy with it. Maybe someone else comes up with a clever way to\nhandle the following case:\n\n/*\n * Remove empty lines from the beginning and end.\n *\n * Turn multiple consecutive empty lines into just one\n * empty line.\n */\n\nRegards\n\nMarcel\n\n\n"},{"id":"2826","messageId":"20050508210857.GL9495@pasky.ji.cz","threadId":"530","inReplyTo":"1115584015.8949.43.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-08T21:08:58Z","receivedAt":"2005-05-08T21:08:58Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, May 08, 2005 at 10:26:55PM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Petr,\n\nHi,\n\n> > > look at the attached patch. We should use \"fmt -s\" to keep newlines that\n> > > are inside the commit message and there is one unneeded empty CG: line.\n> > \n> > thanks, fixed and pushed out.\n> \n> cool. Now I have everything I am used to from CVS, but ...\n\nExcellent.\n\n> @@ -113,7 +113,9 @@\n>                 # TODO: Prepend a letter describing whether it's addition,\n>                 # removal or update. Or call git status on those files.\n>                 echo \"CG:    $file\" >>$LOGMSG\n> -               [ \"$msgs\" ] && echo $file\n> +               if [ \"$msgs\" ] && ! [ \"$forceeditor\" ]; then\n> +                       echo $file\n> +               fi\n>         done\n>  fi\n> \n> There is no need to print out the files if we start the editor anyway.\n\nThanks, fixed.\n\n> @@ -122,10 +124,10 @@\n>  if tty -s; then\n>         if ! [ \"$msgs\" ] || [ \"$forceeditor\" ]; then\n>                 ${EDITOR:-vi} $LOGMSG2\n> -       fi\n> -       if ! [ \"$msgs\" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> -               rm $LOGMSG $LOGMSG2\n> -               die 'Commit message not modified, commit aborted'\n> +               if ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> +                       rm $LOGMSG $LOGMSG2\n> +                       die 'Commit message not modified, commit aborted'\n> +               fi\n>         fi\n>  else\n> \n> If you provide a commit message via -m and then close the editor without\n> changing it, it will commit the message. I think that will not be the\n> intention of the user.\n\nNow, this is a pretty difficult question. The only other place in the\nCogito toolkit which uses cg-commit -e is now cg-init when doing the\ninitial commit - and you definitively want to commit even if the message\nwas not modified in that case. Also, what if you want to just review\nhow the -m stuff flows like before committing?\n\nOTOH, we might want to stay consistent in behaviour and always abandon\naction when the file was not modified (except for the initial commit).\nPerhaps some -E for that? Other thoughts?\n\n> /*\n>  * Remove empty lines from the beginning and end.\n>  *\n>  * Turn multiple consecutive empty lines into just one\n>  * empty line.\n>  */\n\nBah, that's even easier when you want to squeeze the empty lines inside\nof the commit message. I don't, though.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2828","messageId":"1115587151.8949.74.camel@pegasus","threadId":"530","inReplyTo":"20050508210857.GL9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T21:19:11Z","receivedAt":"2005-05-08T21:19:11Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> > @@ -122,10 +124,10 @@\n> >  if tty -s; then\n> >         if ! [ \"$msgs\" ] || [ \"$forceeditor\" ]; then\n> >                 ${EDITOR:-vi} $LOGMSG2\n> > -       fi\n> > -       if ! [ \"$msgs\" ] && ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> > -               rm $LOGMSG $LOGMSG2\n> > -               die 'Commit message not modified, commit aborted'\n> > +               if ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> > +                       rm $LOGMSG $LOGMSG2\n> > +                       die 'Commit message not modified, commit aborted'\n> > +               fi\n> >         fi\n> >  else\n> > \n> > If you provide a commit message via -m and then close the editor without\n> > changing it, it will commit the message. I think that will not be the\n> > intention of the user.\n> \n> Now, this is a pretty difficult question. The only other place in the\n> Cogito toolkit which uses cg-commit -e is now cg-init when doing the\n> initial commit - and you definitively want to commit even if the message\n> was not modified in that case. Also, what if you want to just review\n> how the -m stuff flows like before committing?\n> \n> OTOH, we might want to stay consistent in behaviour and always abandon\n> action when the file was not modified (except for the initial commit).\n> Perhaps some -E for that? Other thoughts?\n\nI think using -E to commit even when you don't modify the commit message\nis a good idea. The alternative way is to ask the user like CVS does.\n\n> > /*\n> >  * Remove empty lines from the beginning and end.\n> >  *\n> >  * Turn multiple consecutive empty lines into just one\n> >  * empty line.\n> >  */\n> \n> Bah, that's even easier when you want to squeeze the empty lines inside\n> of the commit message. I don't, though.\n\nYou can do that with \"cat -s\", I know. But then you still have to look\nat the first and the last line and delete it if they are empty.\n\nI think it is a good idea to squeeze empty lines, because multi empty\nlines are not useful for commit messages anyway. What do you think?\n\nRegards\n\nMarcel\n\n\n"},{"id":"2833","messageId":"1115588600.8949.77.camel@pegasus","threadId":"530","inReplyTo":"20050508200334.GG9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-08T21:43:20Z","receivedAt":"2005-05-08T21:43:20Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\n> #/bin/sh\n> \n> leading=1\n> emptylines=0\n> while read line; do\n>         if ! [ \"$line\" ]; then\n> \t\t[ \"$leading\" ] && continue\n> \t\temptylines=$(($emptylines + 1))\n>         else\n> \t\tleading=0\n>                 while [ $emptylines -gt 0 ]; do\n>                         echo \"\"\n>                         emptylines=$(($emptylines - 1))\n>                 done\n>                 echo $line\n>         fi\n> done\n> \n> or something? (Based on someone else's script since I was too lazy. ;-)\n\n@@ -134,7 +134,7 @@\n else\n        cat >>$LOGMSG2\n fi\n-grep -v ^CG: $LOGMSG2 >$LOGMSG\n+grep -v ^CG: $LOGMSG2 | sed '/./,${/./b;:a;$d;N;/\\n$/ba;b;};d' >$LOGMSG\n rm $LOGMSG2\n \n \nIf you don't wanna squeeze then you can do it with a one-line in sed.\n\nRegards\n\nMarcel\n\n\n"},{"id":"2834","messageId":"2293.10.10.10.24.1115588808.squirrel@linux1","threadId":"530","inReplyTo":"1115584015.8949.43.camel@pegasus","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2005-05-08T21:46:48Z","receivedAt":"2005-05-08T21:46:48Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Sun, May 8, 2005 4:26 pm, Marcel Holtmann said:\n\n> /*\n>  * Remove empty lines from the beginning and end.\n>  *\n>  * Turn multiple consecutive empty lines into just one\n>  * empty line.\n>  */\n\nsed ' 1{:a;s/^[ \\t]*$//;T;N;s/\\n//;ta}\n      /^[ \\t]*$/{:b;$d;N;s/\\n[ \\t]*$//;tb}'  filename\n\nThere's probably shorter... but it's mothers day.. time to go!\n\nCheers,\nSean\n\n\n"},{"id":"2853","messageId":"20050509052814.617dceac.froese@gmx.de","threadId":"530","inReplyTo":"20050508210857.GL9495@pasky.ji.cz","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Edgar Toernig","fromEmail":"froese@gmx.de","sentAt":"2005-05-09T03:28:14Z","receivedAt":"2005-05-09T03:28:14Z","isPatch":true,"sender":{"key":"froese@gmx.de","avatar":null},"body":"Petr Baudis wrote:\n>\n> > +               if ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> > +                       rm $LOGMSG $LOGMSG2\n> > +                       die 'Commit message not modified, commit aborted'\n> > +               fi\n\nJust in case you come to a conclusion some day, how about changing the\nif-test to\n\n\tif cmp -s $LOGMSG LOGMSG2; then\n\n?  :-)  IMHO much better then comparing only the date.\n\nCiao, ET.\n"},{"id":"2866","messageId":"20050509073333.GC3599@pasky.ji.cz","threadId":"530","inReplyTo":"20050509052814.617dceac.froese@gmx.de","subject":"Re: [PATCH Cogito] Make use of external editor work like CVS","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-09T07:33:33Z","receivedAt":"2005-05-09T07:33:33Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, May 09, 2005 at 05:28:14AM CEST, I got a letter\nwhere Edgar Toernig <froese@gmx.de> told me that...\n> Petr Baudis wrote:\n> >\n> > > +               if ! [ $LOGMSG2 -nt $LOGMSG ]; then\n> > > +                       rm $LOGMSG $LOGMSG2\n> > > +                       die 'Commit message not modified, commit aborted'\n> > > +               fi\n> \n> Just in case you come to a conclusion some day, how about changing the\n> if-test to\n> \n> \tif cmp -s $LOGMSG LOGMSG2; then\n> \n> ?  :-)  IMHO much better then comparing only the date.\n> \n> Ciao, ET.\n\nMuch, much worse. What if I really actually do not want to change\nanything in the merge message or the series of -m's? Ok, :x didn't work\nnow since we cannot know. But now, :wq won't do either, and you actually\nneed to do some silly dummy change now.\n\nI think we should really ask the user as CVS, as Marcel (or whoever)\nsuggested.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"}]}