{"thread":{"id":"27323","subject":"[BUG?] git revert option parsing too lenient?","startedAt":"2011-05-11T10:40:27Z","lastAt":"2011-05-11T20:51:46Z","messageCount":5,"participants":["Sverre Rabbelier","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"167659","messageId":"BANLkTi=dPzu0wrDr3aycEv68M2tw7k5m8A@mail.gmail.com","threadId":"27323","inReplyTo":null,"subject":"[BUG?] git revert option parsing too lenient?","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-05-11T10:40:27Z","receivedAt":"2011-05-11T10:40:27Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nI just did 'git revert -p <commit>', hoping I might be able to\npartially revert a commit, but it just ignored the -p (it's not\nsupported) rather than erroring out. Is this expected behavior?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"167687","messageId":"20110511203645.GB28742@sigill.intra.peff.net","threadId":"27323","inReplyTo":"BANLkTi=dPzu0wrDr3aycEv68M2tw7k5m8A@mail.gmail.com","subject":"Re: [BUG?] git revert option parsing too lenient?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-11T20:36:45Z","receivedAt":"2011-05-11T20:36:45Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 11, 2011 at 12:40:27PM +0200, Sverre Rabbelier wrote:\n\n> I just did 'git revert -p <commit>', hoping I might be able to\n> partially revert a commit, but it just ignored the -p (it's not\n> supported) rather than erroring out. Is this expected behavior?\n\nYeah, this is a problem with many commands that take revision\nparameters. The revision option parser will parse all of the log and\ndiff options, modifying the rev_info struct, and then the resulting\ncommand may or may not do anything useful with the values. You can even\ndo:\n\n  git revert --pretty=oneline -p --date=iso --renames $sha1\n\nall of which is equivalent to just:\n\n  git revert $sha1\n\nSo yeah, it's a bug, but it is a known one. The trouble is that fixing\nit means splitting the revision options into a set of \"these are OK for\npicking a revision or range of revisions\" and \"other options\", and\nletting commands like revert use one set but not the other. And I'm not\neven sure if that distinction is sufficient for all of the commands that\nuse setup_revisions.\n\n-Peff\n"},{"id":"167688","messageId":"BANLkTin5FMYJkeLTNeZ47jsXtVxvrLRL+Q@mail.gmail.com","threadId":"27323","inReplyTo":"20110511203645.GB28742@sigill.intra.peff.net","subject":"Re: [BUG?] git revert option parsing too lenient?","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-05-11T20:44:48Z","receivedAt":"2011-05-11T20:44:48Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Wed, May 11, 2011 at 22:36, Jeff King <peff@peff.net> wrote:\n> So yeah, it's a bug, but it is a known one. The trouble is that fixing\n> it means splitting the revision options into a set of \"these are OK for\n> picking a revision or range of revisions\" and \"other options\", and\n> letting commands like revert use one set but not the other.\n\nDoing the splitting doesn't sound that hard, I assume the real problem\nis getting the option parser to look through both tables?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"167689","messageId":"20110511204851.GA29146@sigill.intra.peff.net","threadId":"27323","inReplyTo":"BANLkTin5FMYJkeLTNeZ47jsXtVxvrLRL+Q@mail.gmail.com","subject":"Re: [BUG?] git revert option parsing too lenient?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-11T20:48:51Z","receivedAt":"2011-05-11T20:48:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 11, 2011 at 10:44:48PM +0200, Sverre Rabbelier wrote:\n\n> On Wed, May 11, 2011 at 22:36, Jeff King <peff@peff.net> wrote:\n> > So yeah, it's a bug, but it is a known one. The trouble is that fixing\n> > it means splitting the revision options into a set of \"these are OK for\n> > picking a revision or range of revisions\" and \"other options\", and\n> > letting commands like revert use one set but not the other.\n> \n> Doing the splitting doesn't sound that hard, I assume the real problem\n> is getting the option parser to look through both tables?\n\nNo, it wouldn't be that hard. You'd split handle_revision_opt into two\nfunctions, and then probably callers of setup_revisions would pass in a\nflag to say whether which subset they were interested in.\n\nMaybe the splitting isn't hard. But I suspect it is one of those \"the\ndevil is in the details\" tasks where you will find that the options do\nnot fit as plainly into categories as you want. But I might be wrong.\nAnd I don't want to discourage you from trying to work on it. :)\n\n-Peff\n"},{"id":"167690","messageId":"BANLkTi=ScEiUiE7Lm4LnhcWLGCzOWK5YQw@mail.gmail.com","threadId":"27323","inReplyTo":"20110511204851.GA29146@sigill.intra.peff.net","subject":"Re: [BUG?] git revert option parsing too lenient?","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-05-11T20:51:46Z","receivedAt":"2011-05-11T20:51:46Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Wed, May 11, 2011 at 22:48, Jeff King <peff@peff.net> wrote:\n> And I don't want to discourage you from trying to work on it. :)\n\nWho knows, maybe I'll have some time to work on git(-remote-hg) sometime :).\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}