{"thread":{"id":"669","subject":"[cogito] paged output for cg-diff","startedAt":"2005-05-20T09:05:08Z","lastAt":"2005-05-20T14:55:46Z","messageCount":3,"participants":["Michal Rokos","Junio C Hamano","Thomas Glanzmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"3600","messageId":"200505201105.08711.michal.rokos@nextsoft.cz","threadId":"669","inReplyTo":null,"subject":"[cogito] paged output for cg-diff","fromName":"Michal Rokos","fromEmail":"michal.rokos@nextsoft.cz","sentAt":"2005-05-20T09:05:08Z","receivedAt":"2005-05-20T09:05:08Z","isPatch":false,"sender":{"key":"michal.rokos@nextsoft.cz","avatar":null},"body":"Hello,\n\nI'm a bit curious what is going on in development so I'm using cg-diff\noften. Usually I pipe it to the less. So for me it would be very nice\nwhen cg-diff behaves as cg-log that pipes output to pager.\n\nSo I changed cg-diff to do so.\n\nNew function PAGER() determines whether output is terminal and uses\nPAGER in that case.\n\nDo you like it?\n\n Michal\n\nSigned-off-by: Michal Rokos <michal@rokos.info>\n\nIndex: cg-Xlib\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-Xlib  (mode:100755)\n+++ uncommitted/cg-Xlib  (mode:100755)\n@@ -91,3 +91,12 @@\n \n export BROKEN_MKTEMP=1\n del=$($(which mktemp) -t 2>/dev/null) && { rm $del; export BROKEN_MKTEMP=; }\n+\n+PAGER () {\n+ if [ -t 1 ]; then\n+  ${PAGER:-less} ${PAGER_FLAGS:--R}\n+ else\n+  cat\n+ fi\n+}\n+\nIndex: cg-diff\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-diff  (mode:100755)\n+++ uncommitted/cg-diff  (mode:100755)\n@@ -71,7 +71,7 @@\n  # FIXME: Update ret based on what did we match. And take \"$@\"\n  # to account after all.\n  ret=\n- git-diff-cache -r -z $tree | xargs -0 ${COGITO_LIB}cg-Xdiffdo \"$tree\" uncommitted \"$filter\"\n+ git-diff-cache -r -z $tree | xargs -0 ${COGITO_LIB}cg-Xdiffdo \"$tree\" uncommitted \"$filter\" | PAGER\n \n  [ \"$filter\" ] && rm $filter\n \n@@ -85,7 +85,7 @@\n \n [ \"$id1\" = \"$id2\" ] && die \"trying to diff $id1 against itself\"\n \n-git-diff-tree -r -z $id1 $id2 | xargs -0 ${COGITO_LIB}cg-Xdiffdo $id1 $id2 \"$filter\"\n+git-diff-tree -r -z $id1 $id2 | xargs -0 ${COGITO_LIB}cg-Xdiffdo $id1 $id2 \"$filter\" | PAGER\n \n [ \"$filter\" ] && rm $filter\n exit 0\nIndex: cg-log\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-log  (mode:100755)\n+++ uncommitted/cg-log  (mode:100755)\n@@ -181,4 +181,4 @@\n \n   done\n  echo\n-done | ${PAGER:-less} ${PAGER_FLAGS:--R}\n+done | PAGER\n\n-- \nMichal Rokos\n\nNextSoft s.r.o.\nVyskočilova 1/1410\n140 21 Praha 4\ntel: +420 267 224 311\nfax: +420 267 224 307\nmobil: +420 736 646 591\ne-mail: michal.rokos@nextsoft.cz\n"},{"id":"3603","messageId":"7v64xevz15.fsf@assigned-by-dhcp.cox.net","threadId":"669","inReplyTo":"200505201105.08711.michal.rokos@nextsoft.cz","subject":"Re: [cogito] paged output for cg-diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-20T12:53:58Z","receivedAt":"2005-05-20T12:53:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"MR\" == Michal Rokos <michal.rokos@nextsoft.cz> writes:\n\nMR> I'm a bit curious what is going on in development so I'm using cg-diff\nMR> often. Usually I pipe it to the less. So for me it would be very nice\nMR> when cg-diff behaves as cg-log that pipes output to pager.\n\nI think that is a sensible thing to do.  But doesn't \"less\"\nalready do this part without being told?\n\nMR> +PAGER () {\nMR> + if [ -t 1 ]; then\nMR> +  ${PAGER:-less} ${PAGER_FLAGS:--R}\nMR> + else\nMR> +  cat\nMR> + fi\nMR> +}\n\n\n"},{"id":"3612","messageId":"20050520145546.GP8105@cip.informatik.uni-erlangen.de","threadId":"669","inReplyTo":"7v64xevz15.fsf@assigned-by-dhcp.cox.net","subject":"Re: [cogito] paged output for cg-diff","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2005-05-20T14:55:46Z","receivedAt":"2005-05-20T14:55:46Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\n\n> I think that is a sensible thing to do.  But doesn't \"less\"\n> already do this part without being told?\n\nyes, every pager does.\n\n\tThomas\n"}]}