{"thread":{"id":"5","subject":"Re: Slight enhancement of GIT wrapper","startedAt":"2005-04-13T22:55:10Z","lastAt":"2005-05-27T16:29:42Z","messageCount":5,"participants":["Petr Baudis","Johannes Schindelin","Pavel Pisa"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18","messageId":"20050413225509.GL25711@pasky.ji.cz","threadId":"5","inReplyTo":"200504132249.16848.pisa@cmp.felk.cvut.cz","subject":"Re: Slight enhancement of GIT wrapper","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-13T22:55:10Z","receivedAt":"2005-04-13T22:55:10Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Apr 13, 2005 at 10:49:16PM CEST, I got a letter\nwhere Pavel Pisa <pisa@cmp.felk.cvut.cz> told me that...\n> Ahoj Petre,\n\nHi,\n\ncc'ing git@vger.kernel.org so that we hopefully get less of duplicated\nwork (and maybe even some more insights).\n\n> Index: commit-id\n> ===================================================================\n> Index: git\n> ===================================================================\n> --- 6c355da7a316f50742eeffa49405a15e75526012/git  (mode:100755 sha1:f766a87adff6e17d24cd97417d7303f2cdab6f3c)\n> +++ 85f2d458ffebf52569e777af222accc1268afdf9/git  (mode:100755 sha1:c179a65c3955e39bda18dc8a314b061bc0fb5de7)\n> @@ -9,6 +9,7 @@\n>  # This command mostly only multiplexes to the individual script based\n>  # on the first argument.\n>  \n> +\n>  error () {\n>  \techo git: $@ >&2\n>  }\n> @@ -17,6 +18,25 @@\n>  \texit 1\n>  }\n>  \n> +cwd=\"`pwd 2> /dev/null`\"\n\nPlease use $() instead of ``.\n\nWhy do you silence stderr?\n\n> +\n> +if [ -h \"$0\" ]; then\n> +  GIT_DIR=`ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/'`\n\nWell, I don't like this much, but I'm not sure how to do better.\n\n> +  GIT_DIR=`dirname \"$GIT_DIR\"`\n> +else\n> +  GIT_DIR=`dirname \"$0\"`\n> +fi\n\nWe use tabs for indentation.\n\n> +cd \"$GIT_DIR\"\n> +GIT_DIR=\"`pwd 2> /dev/null`\"\n\nWhy do you silence stderr?\n\n> +cd \"$cwd\" 2> /dev/null\n> +if [ $? -gt 0 ] ; then\n> +  die \"Cannot return back to the CWD $cwd\"\n> +fi\n\nI'd personally just cd \"$cwd\" || exit 1\n\n> +\n> +export PATH=$GIT_DIR:$PATH\n\nYou should add $GIT_DIR to $PATH only when it is not there already. This\nway you can still override some of the git tools by stuffing your\noverrides to $PATH.\n\n> +\n> +#echo GIT_DIR=$GIT_DIR\n> +#echo PATH=$PATH\n\n?\n\n>  \n>  help () {\n>  \tcat <<__END__\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":"19","messageId":"Pine.LNX.4.58.0504140106470.15139@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"5","inReplyTo":"20050413225509.GL25711@pasky.ji.cz","subject":"Re: Slight enhancement of GIT wrapper","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-04-13T23:07:28Z","receivedAt":"2005-04-13T23:07:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 14 Apr 2005, Petr Baudis wrote:\n\n> Dear diary, on Wed, Apr 13, 2005 at 10:49:16PM CEST, I got a letter\n> where Pavel Pisa <pisa@cmp.felk.cvut.cz> told me that...\n>\n> > +\n> > +if [ -h \"$0\" ]; then\n> > +  GIT_DIR=`ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/'`\n>\n> Well, I don't like this much, but I'm not sure how to do better.\n\nHow about\n\n\tGIT_DIR=$(ls -L \"$0\")\n\nCiao,\nDscho\n"},{"id":"20","messageId":"Pine.LNX.4.58.0504140110340.15139@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"5","inReplyTo":"20050413225509.GL25711@pasky.ji.cz","subject":"Re: Slight enhancement of GIT wrapper","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-04-13T23:10:53Z","receivedAt":"2005-04-13T23:10:53Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nplease ignore the mail I just sent.\n\nCiao,\nDscho\n\n"},{"id":"4051","messageId":"200505271824.05105.pisa@cmp.felk.cvut.cz","threadId":"5","inReplyTo":"20050524111333.GA11223@pasky.ji.cz","subject":"GIT and COGITO individual scripts hidding from PATH","fromName":"Pavel Pisa","fromEmail":"pisa@cmp.felk.cvut.cz","sentAt":"2005-05-27T16:24:04Z","receivedAt":"2005-05-27T16:24:04Z","isPatch":false,"sender":{"key":"pisa@cmp.felk.cvut.cz","avatar":null},"body":"Hello All,\n\nI prefer to have as small number of executables in /usr/bin\nand /user/local/bin as possible. I have tried to push original\nPeter's git script to this direction for my strange personal taste.\nCOGITO has taken different direction than. I have hidden cogito and git\nunder wrapper to make me happy again. I thing that it is against good\nopensource habits to keep changes secret even if I do not expect\ninterrest in this version. But may it be, that it can make\nhappy somebody with same taste as I have.\n\nThe \"cgt\" is wrapper for all cogito programs. If cogito is\nbuild and installed to any prefix directory (/opt/git-cogito in my case)\nand script is copied to bin subdirectory (/opt/git-cogito/bin),\nthen only single symbolic link from some searchable directory on PATH\nis enough to call all cogito commands\n  cgt pull\n  cgt update\nso usage is more convenient for my fingers learned to type cvs up, etc.\nI think, that addition of intelligent bash completion could be done easier\nif number of the first level commands to cover is smaller.\n\nBest wishes\n\n        Pavel Pisa\n\n\"cgt\" script\n--------------------------------------------------------------------------------\n#!/usr/bin/env bash\n#\n# The GIT scripted toolkit.\n# Copyright (c) Petr Baudis, 2005\n#\n# Script to automatically wrap individual GIT commands under one script\n# for those, who prefer only one or two links in /usr/local/bin\n# This script added by Pavel Pisa <pisa@cmp.felk.cvut.cz>\n#\n# This command mostly only multiplexes to the individual scripts based\n# on the first argument.\n\nerror () {\n\techo cgt: $@ >&2\n}\ndie () {\n\terror $@\n\texit 1\n}\n\nif [ -z \"$GIT_TOOLS_DIR\" ] ; then\n\tGIT_MUXBINARY_DIR=\"$(dirname \"$0\")\"\n\tif [ -h \"$0\" ]; then\n\t\t#GIT_TOOLS_DIR=\"$(ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/')\"\n\t\tGIT_TOOLS_DIR=\"$(readlink -f -n $0)\"\n\t        GIT_TOOLS_DIR=\"$(dirname \"$GIT_TOOLS_DIR\")\"\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; cd \"$GIT_TOOLS_DIR\" ; pwd )\"\n\telse\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; pwd )\"\n\tfi\n\n\tif [ -z \"$(echo :$PATH: | sed -n -e 's#:'\"$GIT_TOOLS_DIR\"':#yes#p' )\" ] ; \nthen\n\t\texport PATH=\"$GIT_TOOLS_DIR:$PATH\"\n\tfi\n\n\texport GIT_TOOLS_DIR\nfi\n\n#echo =$GIT_TOOLS_DIR\n#echo PATH=$PATH\n#echo CWD=$(pwd)\n#exit \n\nhelp () {\n\techo \"cgt recognizes next commands:\" >&2 \n\t(cd $GIT_TOOLS_DIR ; ls cg-* ) | sed -n -e 's/\\<cg-\\([^ ]*\\)\\>/\\1/pg' >&2 \n}\n\n\ncmd=$1; shift\n\nif [ ! \"$cmd\" ]; then\n\terror \"missing command\"\n\thelp\n\texit 1\nfi\n\ncgt_cmd_exe=\"${GIT_TOOLS_DIR}/cg-$cmd\"\n\nif [ ! -e \"$cgt_cmd_exe\" ]; then\n\terror \"unrecognized command ${cmd}\"\n\thelp\n\texit 1\nfi\n\n\"$cgt_cmd_exe\" \"$@\"\n--------------------------------------------------------------------------------\n\n\"git\" script\n--------------------------------------------------------------------------------\n#!/usr/bin/env bash\n#\n# The GIT scripted toolkit.\n# Copyright (c) Petr Baudis, 2005\n#\n# Script to automatically wrap individual GIT commands under one script\n# for those, who prefer only one or two links in /usr/local/bin\n# This script added by Pavel Pisa <pisa@cmp.felk.cvut.cz>\n#\n# This command mostly only multiplexes to the individual scripts based\n# on the first argument.\n\nerror () {\n\techo git: $@ >&2\n}\ndie () {\n\terror $@\n\texit 1\n}\n\nif [ -z \"$GIT_TOOLS_DIR\" ] ; then\n\tGIT_MUXBINARY_DIR=\"$(dirname \"$0\")\"\n\tif [ -h \"$0\" ]; then\n\t\t#GIT_TOOLS_DIR=\"$(ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/')\"\n\t\tGIT_TOOLS_DIR=\"$(readlink -f -n $0)\"\n\t        GIT_TOOLS_DIR=\"$(dirname \"$GIT_TOOLS_DIR\")\"\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; cd \"$GIT_TOOLS_DIR\" ; pwd )\"\n\telse\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; pwd )\"\n\tfi\n\n\tif [ -z \"$(echo :$PATH: | sed -n -e 's#:'\"$GIT_TOOLS_DIR\"':#yes#p' )\" ] ; \nthen\n\t\texport PATH=\"$GIT_TOOLS_DIR:$PATH\"\n\tfi\n\n\texport GIT_TOOLS_DIR\nfi\n\n#echo =$GIT_TOOLS_DIR\n#echo PATH=$PATH\n#echo CWD=$(pwd)\n#exit \n\nhelp () {\n\techo \"git recognizes next commands:\" >&2 \n\t(cd $GIT_TOOLS_DIR ; ls git-* ) | sed -n -e 's/\\<git-\\([^ ]*\\)\\>/\\1/pg' >&2 \n}\n\n\ncmd=$1; shift\n\nif [ ! \"$cmd\" ]; then\n\terror \"missing command\"\n\thelp\n\texit 1\nfi\n\ngit_cmd_exe=\"${GIT_TOOLS_DIR}/git-$cmd\"\n\nif [ ! -e \"$git_cmd_exe\" ]; then\n\terror \"unrecognized command ${cmd}\"\n\thelp\n\texit 1\nfi\n\n\"$git_cmd_exe\" \"$@\"\n--------------------------------------------------------------------------------\n\n"},{"id":"4053","messageId":"200505271829.43511.pisa@cmp.felk.cvut.cz","threadId":"5","inReplyTo":"200505271824.05105.pisa@cmp.felk.cvut.cz","subject":"Re: GIT and COGITO individual scripts hidding from PATH","fromName":"Pavel Pisa","fromEmail":"pisa@cmp.felk.cvut.cz","sentAt":"2005-05-27T16:29:42Z","receivedAt":"2005-05-27T16:29:42Z","isPatch":false,"sender":{"key":"pisa@cmp.felk.cvut.cz","avatar":null},"body":"Excuse me for resending of e-mail again, but I have forget\nto disable wrapping of lines. Sending as attachmet would be\nmore secure, but I do not know, if it is convenient\non the git list.\n\nThe \"cgt\" is wrapper for all cogito programs. If cogito is\nbuild and installed to any prefix directory (/opt/git-cogito in my case)\nand script is copied to bin subdirectory (/opt/git-cogito/bin),\nthen only single symbolic link from some searchable directory on PATH\nis enough to call all cogito commands\n  cgt pull\n  cgt update\nso usage is more convenient for my fingers learned to type cvs up, etc.\nI think, that addition of intelligent bash completion could be done easier\nif number of the first level commands to cover is smaller.\n\n\"cgt\" script\n---------------------------------------------------------------------------\n#!/usr/bin/env bash\n#\n# The GIT scripted toolkit.\n# Copyright (c) Petr Baudis, 2005\n#\n# Script to automatically wrap individual GIT commands under one script\n# for those, who prefer only one or two links in /usr/local/bin\n# This script added by Pavel Pisa <pisa@cmp.felk.cvut.cz>\n#\n# This command mostly only multiplexes to the individual scripts based\n# on the first argument.\n\nerror () {\n\techo cgt: $@ >&2\n}\ndie () {\n\terror $@\n\texit 1\n}\n\nif [ -z \"$GIT_TOOLS_DIR\" ] ; then\n\tGIT_MUXBINARY_DIR=\"$(dirname \"$0\")\"\n\tif [ -h \"$0\" ]; then\n\t\t#GIT_TOOLS_DIR=\"$(ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/')\"\n\t\tGIT_TOOLS_DIR=\"$(readlink -f -n $0)\"\n\t        GIT_TOOLS_DIR=\"$(dirname \"$GIT_TOOLS_DIR\")\"\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; cd \"$GIT_TOOLS_DIR\" ; pwd )\"\n\telse\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; pwd )\"\n\tfi\n\n\tif [ -z \"$(echo :$PATH: | sed -n -e 's#:'\"$GIT_TOOLS_DIR\"':#yes#p' )\" ] ; then\n\t\texport PATH=\"$GIT_TOOLS_DIR:$PATH\"\n\tfi\n\n\texport GIT_TOOLS_DIR\nfi\n\n#echo =$GIT_TOOLS_DIR\n#echo PATH=$PATH\n#echo CWD=$(pwd)\n#exit \n\nhelp () {\n\techo \"cgt recognizes next commands:\" >&2 \n\t(cd $GIT_TOOLS_DIR ; ls cg-* ) | sed -n -e 's/\\<cg-\\([^ ]*\\)\\>/\\1/pg' >&2 \n}\n\n\ncmd=$1; shift\n\nif [ ! \"$cmd\" ]; then\n\terror \"missing command\"\n\thelp\n\texit 1\nfi\n\ncgt_cmd_exe=\"${GIT_TOOLS_DIR}/cg-$cmd\"\n\nif [ ! -e \"$cgt_cmd_exe\" ]; then\n\terror \"unrecognized command ${cmd}\"\n\thelp\n\texit 1\nfi\n\n\"$cgt_cmd_exe\" \"$@\"\n---------------------------------------------------------------------------\n\n\"git\" script\n---------------------------------------------------------------------------\n#!/usr/bin/env bash\n#\n# The GIT scripted toolkit.\n# Copyright (c) Petr Baudis, 2005\n#\n# Script to automatically wrap individual GIT commands under one script\n# for those, who prefer only one or two links in /usr/local/bin\n# This script added by Pavel Pisa <pisa@cmp.felk.cvut.cz>\n#\n# This command mostly only multiplexes to the individual scripts based\n# on the first argument.\n\nerror () {\n\techo git: $@ >&2\n}\ndie () {\n\terror $@\n\texit 1\n}\n\nif [ -z \"$GIT_TOOLS_DIR\" ] ; then\n\tGIT_MUXBINARY_DIR=\"$(dirname \"$0\")\"\n\tif [ -h \"$0\" ]; then\n\t\t#GIT_TOOLS_DIR=\"$(ls -l \"$0\" | sed 's/^.*-> *\\(.*\\) *$/\\1/')\"\n\t\tGIT_TOOLS_DIR=\"$(readlink -f -n $0)\"\n\t        GIT_TOOLS_DIR=\"$(dirname \"$GIT_TOOLS_DIR\")\"\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; cd \"$GIT_TOOLS_DIR\" ; pwd )\"\n\telse\n\t\tGIT_TOOLS_DIR=\"$(cd \"$GIT_MUXBINARY_DIR\" ; pwd )\"\n\tfi\n\n\tif [ -z \"$(echo :$PATH: | sed -n -e 's#:'\"$GIT_TOOLS_DIR\"':#yes#p' )\" ] ; then\n\t\texport PATH=\"$GIT_TOOLS_DIR:$PATH\"\n\tfi\n\n\texport GIT_TOOLS_DIR\nfi\n\n#echo =$GIT_TOOLS_DIR\n#echo PATH=$PATH\n#echo CWD=$(pwd)\n#exit \n\nhelp () {\n\techo \"git recognizes next commands:\" >&2 \n\t(cd $GIT_TOOLS_DIR ; ls git-* ) | sed -n -e 's/\\<git-\\([^ ]*\\)\\>/\\1/pg' >&2 \n}\n\n\ncmd=$1; shift\n\nif [ ! \"$cmd\" ]; then\n\terror \"missing command\"\n\thelp\n\texit 1\nfi\n\ngit_cmd_exe=\"${GIT_TOOLS_DIR}/git-$cmd\"\n\nif [ ! -e \"$git_cmd_exe\" ]; then\n\terror \"unrecognized command ${cmd}\"\n\thelp\n\texit 1\nfi\n\n\"$git_cmd_exe\" \"$@\"\n---------------------------------------------------------------------------\n"}]}