{"thread":{"id":"925","subject":"[PATCH] Adding Correct Useage Notification and -h Help flag","startedAt":"2005-06-14T01:47:22Z","lastAt":"2005-06-14T21:49:36Z","messageCount":6,"participants":["James Purser","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4927","messageId":"1118713641.8712.10.camel@localhost.localdomain","threadId":"925","inReplyTo":null,"subject":"[PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"James Purser","fromEmail":"purserj@winnsw.com.au","sentAt":"2005-06-14T01:47:22Z","receivedAt":"2005-06-14T01:47:22Z","isPatch":true,"sender":{"key":"purserj@winnsw.com.au","avatar":null},"body":"okay this is my first patch so take it easy on me.\n\nI have added both a Correct Useage notification when git is called on\nits own without any other parameters and a -h help flag which lists\navailable scripts for the git command.\n\nSigned-off-by: James Purser <purserj@k-sit.com>\n\n\n-- \nJames Purser\nWinnet Developer\n+61 2 4223 4131\nhttp://www.winnet.com.au\n\n\nAdded a couple of lines to the git wrapper. Includes Correct Useage and available scripts\n\n---\ncommit bfe72d41d70f9e4c0a6ab0ec6cf49347f980f4de\ntree a8eed80ea2ac00ffee0b4f12ed4c931ca7761000\nparent 940c1bb0181cb20454bf3573134175f86983a0ce\nauthor James Purser <purserj@k-sit.com> Tue, 14 Jun 2005 11:40:20 +1000\ncommitter James Purser <purserj@k-sit.com> Tue, 14 Jun 2005 11:40:20 +1000\n\n git |   31 ++++++++++++++++++++++++++++---\n 1 files changed, 28 insertions(+), 3 deletions(-)\n\ndiff --git a/git b/git\n--- a/git\n+++ b/git\n@@ -1,4 +1,29 @@\n #!/bin/sh\n-cmd=\"git-$1-script\"\n-shift\n-exec $cmd \"$@\"\n+if [ \"$1\" = \"\" ]\n+then\n+\techo \"Correct Useage: git [-h] [SCRIPT]\";\n+else \n+\tif [ \"$1\" = \"-h\" ]\n+\tthen\n+\t\techo \"This is a basic script wrapper for certain git functions. The available commands are:\n+\n+git apply-patch\n+git commit\n+git cvsimport\n+git deltafy\n+git diff\n+git fetch\n+git log\n+git merge-one-file\n+git prune\n+git pull\n+git status\n+git tag\n+\";\t\n+\telse\n+\t\tcmd=\"git-$1-script\";\n+\t\tshift;\n+\t\texec $cmd \"$@\";\n+\tfi\n+fi\n+\n"},{"id":"4937","messageId":"7vmzptbrsg.fsf@assigned-by-dhcp.cox.net","threadId":"925","inReplyTo":"1118713641.8712.10.camel@localhost.localdomain","subject":"Re: [PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-14T02:23:11Z","receivedAt":"2005-06-14T02:23:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\n>>Added a couple of lines to the git wrapper. Includes Correct\n>>Useage and available scripts\n\nI like the general direction of making \"git\" wrapper novice\nfriendly, but have some suggestions to the implementation.\n\n (0) Do not mention that only certain subset is accessible.\n     Just saying \"Available commands are:\" would be enough, and\n     would not leave the end user wondering what he is missing.\n\n (1) Instead of explicitly checking for -h, you may want to\n     structure it like this:\n\n         #!/bin/sh\n\n         cmd=\"git-$1-script\";\n         shift;\n         exec $cmd \"$@\";\n         echo \"Usage: git <subcommand> [<param>...]\"\n         echo 'Available commands are:\"\n         git bar\n\t git foo\n         ...\n         '\n         exit 1\n\n     Alternatively, you could say:\n\n         #!/bin/sh\n\n         case \"$1\" in\n         -h)\n             echo \"Usage: git <subcommand> [<param>...]\"\n             echo 'Available commands are:\n         git bar\n\t git foo\n         ...\n         '\n             exit 0 ;;\n\t esac\n\n         cmd=\"git-$1-script\";\n         shift;\n         exec $cmd \"$@\";\n\t git -h\n         exit 1\n\n (2) Maintaining the list of commands by hand in git script\n     itself have an advantage that you _could_ describe the\n     options and parameters they take, but you are not doing\n     that in your patch (hint, hint).\n\n     If all you give is the list of subcommand names, have\n     git.in as a source file, and create the \"list of available\n     commands\" from the Makefile, like this:\n\n     === Makefile ===\n     ...\n     git : git.in\n         /bin/sh ls -1 git-*-script | \\\n         sed -e 's/git-\\(.*\\)-script/git \\1/' >.git-cmd-list\n         sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@\n         rm -f .git-cmd-list\n\n     === git.in ===\n     #!/bin/sh\n\n     cmd=\"git-$1-script\";\n     shift;\n     exec $cmd \"$@\";\n     echo \"Usage: git <subcommand> [<param>...]\"\n     echo 'Available commands are:\n     @@LIST_OF_COMMANDS@@\n     '\n\n"},{"id":"4939","messageId":"1118716092.8712.14.camel@localhost.localdomain","threadId":"925","inReplyTo":"7vmzptbrsg.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"James Purser","fromEmail":"purserj@winnsw.com.au","sentAt":"2005-06-14T02:28:13Z","receivedAt":"2005-06-14T02:28:13Z","isPatch":true,"sender":{"key":"purserj@winnsw.com.au","avatar":null},"body":"Thanks for the tips, I shall submit a new patch along these lines when I\nget home from work tonight.\n\nOn Tue, 2005-06-14 at 12:23, Junio C Hamano wrote:\n> >>Added a couple of lines to the git wrapper. Includes Correct\n> >>Useage and available scripts\n> \n> I like the general direction of making \"git\" wrapper novice\n> friendly, but have some suggestions to the implementation.\n> \n>  (0) Do not mention that only certain subset is accessible.\n>      Just saying \"Available commands are:\" would be enough, and\n>      would not leave the end user wondering what he is missing.\n> \n>  (1) Instead of explicitly checking for -h, you may want to\n>      structure it like this:\n> \n>          #!/bin/sh\n> \n>          cmd=\"git-$1-script\";\n>          shift;\n>          exec $cmd \"$@\";\n>          echo \"Usage: git <subcommand> [<param>...]\"\n>          echo 'Available commands are:\"\n>          git bar\n> \t git foo\n>          ...\n>          '\n>          exit 1\n> \n>      Alternatively, you could say:\n> \n>          #!/bin/sh\n> \n>          case \"$1\" in\n>          -h)\n>              echo \"Usage: git <subcommand> [<param>...]\"\n>              echo 'Available commands are:\n>          git bar\n> \t git foo\n>          ...\n>          '\n>              exit 0 ;;\n> \t esac\n> \n>          cmd=\"git-$1-script\";\n>          shift;\n>          exec $cmd \"$@\";\n> \t git -h\n>          exit 1\n> \n>  (2) Maintaining the list of commands by hand in git script\n>      itself have an advantage that you _could_ describe the\n>      options and parameters they take, but you are not doing\n>      that in your patch (hint, hint).\n> \n>      If all you give is the list of subcommand names, have\n>      git.in as a source file, and create the \"list of available\n>      commands\" from the Makefile, like this:\n> \n>      === Makefile ===\n>      ...\n>      git : git.in\n>          /bin/sh ls -1 git-*-script | \\\n>          sed -e 's/git-\\(.*\\)-script/git \\1/' >.git-cmd-list\n>          sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@\n>          rm -f .git-cmd-list\n> \n>      === git.in ===\n>      #!/bin/sh\n> \n>      cmd=\"git-$1-script\";\n>      shift;\n>      exec $cmd \"$@\";\n>      echo \"Usage: git <subcommand> [<param>...]\"\n>      echo 'Available commands are:\n>      @@LIST_OF_COMMANDS@@\n>      '\n> \n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n-- \nJames Purser\nWinnet Developer\n+61 2 4223 4131\nhttp://www.winnet.com.au\n\n"},{"id":"4940","messageId":"1118726714.8712.22.camel@localhost.localdomain","threadId":"925","inReplyTo":"7vmzptbrsg.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"James Purser","fromEmail":"purserj@winnsw.com.au","sentAt":"2005-06-14T05:25:14Z","receivedAt":"2005-06-14T05:25:14Z","isPatch":true,"sender":{"key":"purserj@winnsw.com.au","avatar":null},"body":"One thing I would like to double check.\n\nWhen running git commit I am told to run git-update-cache against the\nfiles I want to commit. Would it be easier to have the git-commit-script\nrun this itself? Take out that second step and all that.\n-- \nJames Purser\nWinnet Developer\n+61 2 4223 4131\nhttp://www.winnet.com.au\n\n"},{"id":"4941","messageId":"7vaclt8oyu.fsf@assigned-by-dhcp.cox.net","threadId":"925","inReplyTo":"1118726714.8712.22.camel@localhost.localdomain","subject":"Re: [PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-14T05:52:25Z","receivedAt":"2005-06-14T05:52:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"JP\" == James Purser <purserj@winnsw.com.au> writes:\n\nJP> When running git commit I am told to run git-update-cache\nJP> against the files I want to commit. Would it be easier to\nJP> have the git-commit-script run this itself? Take out that\nJP> second step and all that.\n\nThat's a question better asked Linus, not me.  My preference\nwould be (1) to ask the user if he wants us to automatically run\ngit-update-cache to all of those files, giving him an option to\ndecline and sort things out himself; or (2) leave things as they\nare.\n\nThe core GIT treats the index file and the working directory\ncontents two logically separate entities, and we always require\nthe user to consciously tell us what to put in and remove from\nthe index file.  The core GIT is all about committed tree\nobjects and the index file, and the working directory is merely\na temporary area the user can use to build the state the user\nwishes to have in the index file.  From this point of view,\nrunning git-update-cache ourselves without asking the user is a\ndefinite no-no.\n\n"},{"id":"4955","messageId":"1118785776.3068.4.camel@kryten","threadId":"925","inReplyTo":"7vmzptbrsg.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Adding Correct Useage Notification and -h Help flag","fromName":"James Purser","fromEmail":"purserj@winnsw.com.au","sentAt":"2005-06-14T21:49:36Z","receivedAt":"2005-06-14T21:49:36Z","isPatch":true,"sender":{"key":"purserj@winnsw.com.au","avatar":null},"body":"Heres the revised patch along the lines you recommended yesterday. I am\nstill working on some of the command descriptions.\n\nOn the git-update-cache question, I think having a flag [-u] or\nsomething like that in git commit would allow the user to decide to run\ngit-update-cache on only the files specified in the git commit command.\n\nSigned-off-by: James Purser <purserj@k-sit.com>\nOn Tue, 2005-06-14 at 12:23, Junio C Hamano wrote:\n> >>Added a couple of lines to the git wrapper. Includes Correct\n> >>Useage and available scripts\n> \n> I like the general direction of making \"git\" wrapper novice\n> friendly, but have some suggestions to the implementation.\n> \n>  (0) Do not mention that only certain subset is accessible.\n>      Just saying \"Available commands are:\" would be enough, and\n>      would not leave the end user wondering what he is missing.\n> \n>  (1) Instead of explicitly checking for -h, you may want to\n>      structure it like this:\n> \n>          #!/bin/sh\n> \n>          cmd=\"git-$1-script\";\n>          shift;\n>          exec $cmd \"$@\";\n>          echo \"Usage: git <subcommand> [<param>...]\"\n>          echo 'Available commands are:\"\n>          git bar\n> \t git foo\n>          ...\n>          '\n>          exit 1\n> \n>      Alternatively, you could say:\n> \n>          #!/bin/sh\n> \n>          case \"$1\" in\n>          -h)\n>              echo \"Usage: git <subcommand> [<param>...]\"\n>              echo 'Available commands are:\n>          git bar\n> \t git foo\n>          ...\n>          '\n>              exit 0 ;;\n> \t esac\n> \n>          cmd=\"git-$1-script\";\n>          shift;\n>          exec $cmd \"$@\";\n> \t git -h\n>          exit 1\n> \n>  (2) Maintaining the list of commands by hand in git script\n>      itself have an advantage that you _could_ describe the\n>      options and parameters they take, but you are not doing\n>      that in your patch (hint, hint).\n> \n>      If all you give is the list of subcommand names, have\n>      git.in as a source file, and create the \"list of available\n>      commands\" from the Makefile, like this:\n> \n>      === Makefile ===\n>      ...\n>      git : git.in\n>          /bin/sh ls -1 git-*-script | \\\n>          sed -e 's/git-\\(.*\\)-script/git \\1/' >.git-cmd-list\n>          sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@\n>          rm -f .git-cmd-list\n> \n>      === git.in ===\n>      #!/bin/sh\n> \n>      cmd=\"git-$1-script\";\n>      shift;\n>      exec $cmd \"$@\";\n>      echo \"Usage: git <subcommand> [<param>...]\"\n>      echo 'Available commands are:\n>      @@LIST_OF_COMMANDS@@\n>      '\n> \n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\nMake the git wrapper a little bit more newbie friendly, when called on its own or with the -h flag will return a list of the commands available\n\n---\ncommit 2ad499f75f0982953e43904085bd1b48dd821c4d\ntree f137c4f3f5ee027b8b4d25a0434929e12eb7c51c\nparent de4971b50076b5ef901c2ae0bbee9dd2c14f06ea\nparent de4971b50076b5ef901c2ae0bbee9dd2c14f06ea\nauthor James Purser <purserj@k-sit.com> Wed, 15 Jun 2005 07:43:20\ncommitter James Purser <purserj@k-sit.com> Wed, 15 Jun 2005 07:43:20\n\n git |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 55 insertions(+), 3 deletions(-)\n\ndiff --git a/git b/git\n--- a/git\n+++ b/git\n@@ -1,4 +1,56 @@\n #!/bin/sh\n-cmd=\"git-$1-script\"\n-shift\n-exec $cmd \"$@\"\n+\n+case \"$1\" in\n+-h|\"\")\n+\techo \"Useage: git <subcommand> [<param 1>, <param 2> ...]\"\n+\techo \"Available commands are:\n+\n+git apply-patch <patch file>\n+\n+\tApplies patch file to local files\n+\t\n+git commit <file 1> <file 2> ...\n+\n+\tCommits local changes to the cache. Before running this script you will need to run git-update-cache on the files you wish to commit.\n+\n+\tWill accept wildcards ie git commit git-*-scripts\n+\n+git cvsimport [-v] [-z fuzz] <cvsroot> <module>\n+\t\n+\tCVS to Git import tool. Relies on the cvsps package at least 2.1\n+\t\n+\t-v Verbose output\n+\t-z \n+\t<cvsroot> Path to CVS Repository\n+\t<module> Module you want to import into git\n+\n+git deltafy:\n+\n+git diff [<File 1>, <File 2>, ...]\n+\n+\tDiffs between the git cache and specified files. If no files are specified then creates a Diff between contents of the cache and all current files.\n+\n+git fetch:\n+\n+git log:\n+\n+git merge-one-file:\n+\n+git prune:\n+\n+git pull:\n+\n+git status:\n+\n+git tag:\n+\"\n+\texit 0 ;;\n+esac\n+\n+cmd=\"git-$1-script\";\n+shift;\n+exec $cmd \"$@\";\n+git -h\n+exit 1\n+\n+\n"}]}