{"thread":{"id":"14317","subject":"[JGIT PATCH 1/1] jgit: create a tag command","startedAt":"2008-07-06T22:41:35Z","lastAt":"2008-07-17T22:24:37Z","messageCount":13,"participants":["Robin Rosenberg","Mike Ralphson","Shawn O. Pearce","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"82400","messageId":"200807070041.35873.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":null,"subject":"[JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-06T22:41:35Z","receivedAt":"2008-07-06T22:41:35Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"This command allows us to create simple or annotated tags using the jgit command line.\nPGP signed tags are not yet supported.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n\nI ned this for tagging self-jgit-managed automated builds of the Eclipse plugin.\nI could do with an Ant task, but this will work too.\n\n-- robin\n org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java |   96 ++++++++++++++++++++\n 1 files changed, 96 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java b/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\nnew file mode 100644\nindex 0000000..a9377f5\n--- /dev/null\n+++ b/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n@@ -0,0 +1,96 @@\n+/*\n+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.pgm;\n+\n+import org.spearce.jgit.lib.Constants;\n+import org.spearce.jgit.lib.PersonIdent;\n+\n+class Tag extends TextBuiltin {\n+\t@Override\n+\tvoid execute(String[] args) throws Exception {\n+\t\tString tagName = null;\n+\t\tString message = null;\n+\t\tboolean force = false;\n+\t\tfor (int i = 0; i < args.length; ++i) {\n+\t\t\tif (args[i].equals(\"-f\")) {\n+\t\t\t\tforce = true;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].equals(\"-m\")) {\n+\t\t\t\tif (i < args.length - 2)\n+\t\t\t\t\tmessage = args[i++] + \"\\n\";\n+\t\t\t\telse\n+\t\t\t\t\tusage();\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].startsWith(\"-m\")) {\n+\t\t\t\tmessage = args[i].substring(2) + \"\\n\";\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].startsWith(\"-\") && i == args.length - 1)\n+\t\t\t\tusage();\n+\t\t\tif (i == args.length - 1) {\n+\t\t\t\ttagName = args[i];\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tusage();\n+\t\t}\n+\t\tif (!tagName.startsWith(Constants.TAGS_PREFIX + \"/\"))\n+\t\t\ttagName = Constants.TAGS_PREFIX + \"/\" + tagName;\n+\t\tif (!force && db.resolve(tagName) != null) {\n+\t\t\tthrow die(\"fatal: tag '\"\n+\t\t\t\t\t+ tagName.substring(Constants.TAGS_PREFIX.length() + 1)\n+\t\t\t\t\t+ \"' exists\");\n+\t\t}\n+\t\torg.spearce.jgit.lib.Tag tag = new org.spearce.jgit.lib.Tag(db);\n+\t\ttag.setObjId(db.resolve(Constants.HEAD));\n+\t\tif (message != null) {\n+\t\t\tmessage = message.replaceAll(\"\\r\", \"\");\n+\t\t\ttag.setMessage(message);\n+\t\t\ttag.setTagger(new PersonIdent(db));\n+\t\t\ttag.setType(\"commit\");\n+\t\t}\n+\t\ttag.setTag(tagName.substring(Constants.TAGS_PREFIX.length() + 1));\n+\t\ttag.tag();\n+\t}\n+\n+\tprivate void usage() {\n+\t\tnew Throwable().printStackTrace();\n+\t\tthrow die(\"Usage: -m message tag\");\n+\t}\n+}\n-- \n1.5.6.2.220.g44701\n"},{"id":"82403","messageId":"200807070116.39892.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":"200807070041.35873.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-06T23:16:39Z","receivedAt":"2008-07-06T23:16:39Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\nThis command allows us to create simple or annotated tags.\nPGP signed tags are not yet supported.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java |  102 ++++++++++++++++++++\n 1 files changed, 102 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n\nAn obvious omission was not to allow the user to tag anything but HEAD.\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java b/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\nnew file mode 100644\nindex 0000000..110db6b\n--- /dev/null\n+++ b/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n@@ -0,0 +1,102 @@\n+/*\n+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.pgm;\n+\n+import org.spearce.jgit.lib.Constants;\n+import org.spearce.jgit.lib.PersonIdent;\n+\n+class Tag extends TextBuiltin {\n+\t@Override\n+\tvoid execute(String[] args) throws Exception {\n+\t\tString tagName = null;\n+\t\tString message = null;\n+\t\tString ref = \"HEAD\";\n+\t\tboolean force = false;\n+\t\tfor (int i = 0; i < args.length; ++i) {\n+\t\t\tif (args[i].equals(\"-f\")) {\n+\t\t\t\tforce = true;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].equals(\"-m\")) {\n+\t\t\t\tif (i < args.length - 2)\n+\t\t\t\t\tmessage = args[i++] + \"\\n\";\n+\t\t\t\telse\n+\t\t\t\t\tusage();\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].startsWith(\"-m\")) {\n+\t\t\t\tmessage = args[i].substring(2) + \"\\n\";\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (args[i].startsWith(\"-\") && i == args.length - 1)\n+\t\t\t\tusage();\n+\t\t\tif (i == args.length - 2) {\n+\t\t\t\ttagName = args[i];\n+\t\t\t\tref = args[i+1];\n+\t\t\t\t++i;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (i == args.length - 1) {\n+\t\t\t\ttagName = args[i];\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tusage();\n+\t\t}\n+\t\tif (!tagName.startsWith(Constants.TAGS_PREFIX + \"/\"))\n+\t\t\ttagName = Constants.TAGS_PREFIX + \"/\" + tagName;\n+\t\tif (!force && db.resolve(tagName) != null) {\n+\t\t\tthrow die(\"fatal: tag '\"\n+\t\t\t\t\t+ tagName.substring(Constants.TAGS_PREFIX.length() + 1)\n+\t\t\t\t\t+ \"' exists\");\n+\t\t}\n+\t\torg.spearce.jgit.lib.Tag tag = new org.spearce.jgit.lib.Tag(db);\n+\t\ttag.setObjId(db.resolve(ref));\n+\t\tif (message != null) {\n+\t\t\tmessage = message.replaceAll(\"\\r\", \"\");\n+\t\t\ttag.setMessage(message);\n+\t\t\ttag.setTagger(new PersonIdent(db));\n+\t\t\ttag.setType(\"commit\");\n+\t\t}\n+\t\ttag.setTag(tagName.substring(Constants.TAGS_PREFIX.length() + 1));\n+\t\ttag.tag();\n+\t}\n+\n+\tprivate void usage() {\n+\t\tthrow die(\"Usage: -m message tag [head]\");\n+\t}\n+}\n-- \n1.5.6.2.220.g44701\n"},{"id":"82821","messageId":"e2b179460807100831g5d62a0a8nc7e7bf2715f0b9f1@mail.gmail.com","threadId":"14317","inReplyTo":"200807070116.39892.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-07-10T15:31:06Z","receivedAt":"2008-07-10T15:31:06Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/7/7 Robin Rosenberg <robin.rosenberg.lists@dewire.com>:\n>\n> This command allows us to create simple or annotated tags.\n> PGP signed tags are not yet supported.\n>\n> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n\nApologies this will be whitespace damaged, but it's trivial.\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\nb/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\nindex 110db6b..a215fbd 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/pgm/Tag.java\n@@ -47,6 +47,8 @@ class Tag extends TextBuiltin {\n                String message = null;\n                String ref = \"HEAD\";\n                boolean force = false;\n+               if (args.length == 0)\n+                       usage();\n                for (int i = 0; i < args.length; ++i) {\n                        if (args[i].equals(\"-f\")) {\n                                force = true;\n@@ -97,6 +99,6 @@ class Tag extends TextBuiltin {\n        }\n\n        private void usage() {\n-               throw die(\"Usage: -m message tag [head]\");\n+               throw die(\"Usage: [-m message] [-f] tag [head]\");\n        }\n }\n\nSigned-off-by: Mike Ralphson <mike@abacus.co.uk>\n\nLoving the make_jgit stuff.\n\nMike\n"},{"id":"82832","messageId":"200807102002.11044.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":"e2b179460807100831g5d62a0a8nc7e7bf2715f0b9f1@mail.gmail.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-10T18:02:10Z","receivedAt":"2008-07-10T18:02:10Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdagen den 10 juli 2008 17.31.06 skrev Mike Ralphson:\n> 2008/7/7 Robin Rosenberg <robin.rosenberg.lists@dewire.com>:\n> >\n> > This command allows us to create simple or annotated tags.\n> > PGP signed tags are not yet supported.\n> >\n> > Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n> \n> Apologies this will be whitespace damaged, but it's trivial.\nDon't do like that again : Had to use patch -l to apply this.  Why doesn't git am have that?\n\nAnyway thanks for the fix.\n\n-- robin\n"},{"id":"82911","messageId":"20080711020507.GD31862@spearce.org","threadId":"14317","inReplyTo":"e2b179460807100831g5d62a0a8nc7e7bf2715f0b9f1@mail.gmail.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-11T02:05:07Z","receivedAt":"2008-07-11T02:05:07Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> \n> Loving the make_jgit stuff.\n\nSo making jgit a single stand-alone, portable shell script for\ncommand line usage was a good idea?  ;-)\n\nI think we are at the point where we need to either write a\n#@!*(!@(! command line option parser, import one, or stop writing\ncommand line programs.  I would certainly appreciate any opinion\nyou might have on the matter.\n\n-- \nShawn.\n"},{"id":"82934","messageId":"200807111028.32973.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":"20080711020507.GD31862@spearce.org","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-11T08:28:32Z","receivedAt":"2008-07-11T08:28:32Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"fredagen den 11 juli 2008 04.05.07 skrev Shawn O. Pearce:\n> Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> > \n> > Loving the make_jgit stuff.\n> \n> So making jgit a single stand-alone, portable shell script for\n> command line usage was a good idea?  ;-)\n> \n> I think we are at the point where we need to either write a\n> #@!*(!@(! command line option parser, import one, or stop writing\n> command line programs.  I would certainly appreciate any opinion\n> you might have on the matter.\n\nI've come to that conclusion too, but not yet to the code :)\n\n-- robin\n"},{"id":"82936","messageId":"e2b179460807110145n4182978awd3aa3f97c3caac95@mail.gmail.com","threadId":"14317","inReplyTo":"20080711020507.GD31862@spearce.org","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-07-11T08:45:16Z","receivedAt":"2008-07-11T08:45:16Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/7/11 Shawn O. Pearce <spearce@spearce.org>:\n> Mike Ralphson <mike.ralphson@gmail.com> wrote:\n>>\n>> Loving the make_jgit stuff.\n>\n> So making jgit a single stand-alone, portable shell script for\n> command line usage was a good idea?  ;-)\n\nIt certainly seems so to me. It's a nice quick way of seeing what's\nimplemented (I was toying with adding a jgit help command which would\nreflect over the TextBuiltins).\n\nI'm not sure which if any platforms would eventually be better off\nwith a commandline jgit than trying to port c-git though.\n\n> I think we are at the point where we need to either write a\n> #@!*(!@(! command line option parser, import one, or stop writing\n> command line programs.  I would certainly appreciate any opinion\n> you might have on the matter.\n\na) is a distraction, c) is a backwards step, so maybe b) wins.\n\nI don't know what the state of the art of Java option parsers is but\nthere is a port of GNU getopt [1] which might drop in quite easily.\n\nMike\n\nPS apologies for the patch format, I'm stuck with Outlook or gmail,\nand a recalcitrant firewall for the moment.\n\n[1] http://www.urbanophile.com/arenn/hacking/download.html\n"},{"id":"82943","messageId":"m38ww8elu8.fsf_-_@localhost.localdomain","threadId":"14317","inReplyTo":"200807102002.11044.robin.rosenberg.lists@dewire.com","subject":"Differences between git-applu and GNU patch (was: [JGIT PATCH 1/1] jgit: create a tag command)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-07-11T10:50:30Z","receivedAt":"2008-07-11T10:50:30Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:\n\n> torsdagen den 10 juli 2008 17.31.06 skrev Mike Ralphson:\n\n> > \n> > Apologies this will be whitespace damaged, but it's trivial.\n>\n> Don't do like that again : Had to use patch -l to apply this.\n> Why doesn't git am have that?\n\nIt is not git-am that should have implemented -l / --ignore-whitespace\noption, but git-apply... well, beside passing it to git-apply of course.\n\n\nI tried to look up how git-apply is implemented (builtin-apply.c),\nbut it looks like it implements patching itself, and I am not familiar\nat all with this code... BTW. why applying patch is not left to xdiff\ncode?\n\nIt would be nice if git-apply implemented larger subset of GNU patch\noptions, for example --dry-run (which is similar but I think not\nexactly the same as --check), --fuzz=<num> (how it differs from -C<n>?)\n--strip=<num> as equivalent to -p<n>, -l / --ignore-whitespace, \n--reject-file=<rejectfile> together with --reject...\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"83054","messageId":"20080712030104.GB15838@spearce.org","threadId":"14317","inReplyTo":"e2b179460807110145n4182978awd3aa3f97c3caac95@mail.gmail.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-12T03:01:04Z","receivedAt":"2008-07-12T03:01:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> 2008/7/11 Shawn O. Pearce <spearce@spearce.org>:\n> > Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> >>\n> >> Loving the make_jgit stuff.\n> >\n> > So making jgit a single stand-alone, portable shell script for\n> > command line usage was a good idea?  ;-)\n> \n> It certainly seems so to me. It's a nice quick way of seeing what's\n> implemented (I was toying with adding a jgit help command which would\n> reflect over the TextBuiltins).\n\nYea, sadly our builtins don't register themselves into a table so its\na bit difficult to enumerate them at this time.  But it probably would\nnot be a difficult thing to change at all, and since we don't have a\nlot of them yet it wouldn't be that much work to do the conversion.\n \n> I'm not sure which if any platforms would eventually be better off\n> with a commandline jgit than trying to port c-git though.\n\nNot all platforms can compile c git, e.g. they are missing a\nc compiler, but have a JRE handy.  Odd, I know, but sometimes\nthat's how it goes.  Or maybe you have a JRE handy, and want to\njust download the single stand-alone jgit jar to get some sort of a\nbasic git implementation available, so you can clone and build the\nreal thing direct from Junio's sources.\n\nOr maybe you are using a transport (Amazon S3) that C Git just\ndoesn't support.  :-)\n\n> > I think we are at the point where we need to either write a\n> > #@!*(!@(! command line option parser, import one, or stop writing\n> > command line programs.  I would certainly appreciate any opinion\n> > you might have on the matter.\n> \n> a) is a distraction, c) is a backwards step, so maybe b) wins.\n\nI don't disagree, I thought the very same thing myself.\n \n> I don't know what the state of the art of Java option parsers is but\n> there is a port of GNU getopt [1] which might drop in quite easily.\n\nSo I looked at GNU getopt and its at least smaller than Apache\nCommons, and doesn't have this damned-if-you-do, damned-if-you-do\nversion selection choice they offer their end-users.  But it really\nmakes building something like an automatic --help difficult if not\nimpossible, and certainly makes handling numeric vs. ObjectId vs.\nString vs. File arguments annoying.\n\nI'd almost rather just do a).  It wouldn't take long to get something\nsmall rolled out and working.  We don't need to support every goddamn\nweird syntax that C git supports for backward compatability reasons.\n\n> PS apologies for the patch format, I'm stuck with Outlook or gmail,\n> and a recalcitrant firewall for the moment.\n\nSome people are terrified of that system of tubes.  I feel for you.\nDay-job is that way.  :-(\n \n> [1] http://www.urbanophile.com/arenn/hacking/download.html\n\n-- \nShawn.\n"},{"id":"83056","messageId":"20080712034206.GA16101@spearce.org","threadId":"14317","inReplyTo":"20080712030104.GB15838@spearce.org","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-12T03:42:06Z","receivedAt":"2008-07-12T03:42:06Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> \n> > > I think we are at the point where we need to either write a\n> > > #@!*(!@(! command line option parser, import one, or stop writing\n> > > command line programs.  I would certainly appreciate any opinion\n> > > you might have on the matter.\n> > \n> > a) is a distraction, c) is a backwards step, so maybe b) wins.\n> \n> So I looked at GNU getopt and its at least smaller than Apache\n> Commons,\n\nProbably the state-of-the-arg is args4j:\n\n  https://args4j.dev.java.net/\n\nIt uses Java 5 annotations to setup the argument parsing:\n\n  public class SampleMain {\n\n    @Option(name=\"-r\",usage=\"recursively run something\")\n    private boolean recursive;\n\n    @Option(name=\"-o\",usage=\"output to this file\",metaVar=\"OUTPUT\")\n    private File out = new File(\".\");\n\n    @Option(name=\"-str\")        // no usage\n    private String str = \"(default value)\";\n  ...\n\nI'm usually not a big fan of reflection, but it may make sense to\ntake advantage of it in a case like this, and just import args4j\ninto our command line tools.\n\nargs4j is provided under the MIT license.\n\n-- \nShawn.\n"},{"id":"83760","messageId":"200807172331.18059.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":"20080712034206.GA16101@spearce.org","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-17T21:31:17Z","receivedAt":"2008-07-17T21:31:17Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"lördagen den 12 juli 2008 05.42.06 skrev Shawn O. Pearce:\n> \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> > Mike Ralphson <mike.ralphson@gmail.com> wrote:\n> > \n> > > > I think we are at the point where we need to either write a\n> > > > #@!*(!@(! command line option parser, import one, or stop writing\n> > > > command line programs.  I would certainly appreciate any opinion\n> > > > you might have on the matter.\n> > > \n> > > a) is a distraction, c) is a backwards step, so maybe b) wins.\n> > \n> > So I looked at GNU getopt and its at least smaller than Apache\n> > Commons,\n> \n> Probably the state-of-the-arg is args4j:\n> \n>   https://args4j.dev.java.net/\n> \n> It uses Java 5 annotations to setup the argument parsing:\n\nBut it doesn't use GNU getOpt's long/short style parsing which is a BIG loss. Maybe\nwe could contribute it? Or at least not design options incompatible with such an option\nparser.\n\n-- robin\n"},{"id":"83761","messageId":"20080717214520.GB2798@spearce.org","threadId":"14317","inReplyTo":"200807172331.18059.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-17T21:45:20Z","receivedAt":"2008-07-17T21:45:20Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> lördagen den 12 juli 2008 05.42.06 skrev Shawn O. Pearce:\n> > Probably the state-of-the-arg is args4j:\n> > \n> >   https://args4j.dev.java.net/\n> > \n> > It uses Java 5 annotations to setup the argument parsing:\n> \n> But it doesn't use GNU getOpt's long/short style parsing which is a BIG loss. Maybe\n> we could contribute it? Or at least not design options incompatible with such an option\n> parser.\n\nI'm already using long style options, \"--git-dir\", \"$path\" works,\nand I taught a subclass wrapper to split \"--git-dir=$path\" into\nthe two argument format so we can handle the GNU style long options.\n\nShort style options are harder.  You can alias \"-h\" to \"--help\"\nand have both respond, but you cannot get option clusters like\n\"-ar\" to expand to \"-a\",\"-r\" and then parse.  I could have the same\nwrapper handle splitting \"-ar\" into \"-a\",\"-r\" but it cannot handle\n\"-C80r\" as \"-C80\",\"-r\" as it doesn't have any information about\nwhat options take values, and which don't.\n\n\nGetting \"--\" to terminate the end of options is supported, but\nmaking it handle `git log ref -- path` was interesting.  I had to\nmake \"--\" actually an option name, and have it eat all values after\n\"--\" as path specs to implement git-log style arguments.\n\nLooking at the code further its fairly simple.  I don't think it\nwould be difficult for us to tweak what we need, and try to push\npatches upstream.  Well worthwhile actually.  The parser made our pgm\npackage shorter, and we didn't have to waste time writing our own.\nIts well built, and was (mostly) easily extended to handle fully\ntransparent String->RevCommit or String->RevTree parsing.  So its\nworth the few minutes to improve it further.\n\n-- \nShawn.\n"},{"id":"83768","messageId":"200807180024.37766.robin.rosenberg.lists@dewire.com","threadId":"14317","inReplyTo":"20080717214520.GB2798@spearce.org","subject":"Re: [JGIT PATCH 1/1] jgit: create a tag command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-17T22:24:37Z","receivedAt":"2008-07-17T22:24:37Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdagen den 17 juli 2008 23.45.20 skrev Shawn O. Pearce:\n> Looking at the code further its fairly simple.  I don't think it\n> would be difficult for us to tweak what we need, and try to push\n> patches upstream.  Well worthwhile actually.  The parser made our pgm\n> package shorter, and we didn't have to waste time writing our own.\n> Its well built, and was (mostly) easily extended to handle fully\n> transparent String->RevCommit or String->RevTree parsing.  So its\n> worth the few minutes to improve it further.\n\nOk, then. Go ahead.\n\n-- robin\n"}]}