git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG?] git revert option parsing too lenient?
@ 2011-05-11 10:40 Sverre Rabbelier
  2011-05-11 20:36 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Sverre Rabbelier @ 2011-05-11 10:40 UTC (permalink / raw)
  To: Git List

Heya,

I just did 'git revert -p <commit>', hoping I might be able to
partially revert a commit, but it just ignored the -p (it's not
supported) rather than erroring out. Is this expected behavior?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG?] git revert option parsing too lenient?
  2011-05-11 10:40 [BUG?] git revert option parsing too lenient? Sverre Rabbelier
@ 2011-05-11 20:36 ` Jeff King
  2011-05-11 20:44   ` Sverre Rabbelier
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2011-05-11 20:36 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Git List

On Wed, May 11, 2011 at 12:40:27PM +0200, Sverre Rabbelier wrote:

> I just did 'git revert -p <commit>', hoping I might be able to
> partially revert a commit, but it just ignored the -p (it's not
> supported) rather than erroring out. Is this expected behavior?

Yeah, this is a problem with many commands that take revision
parameters. The revision option parser will parse all of the log and
diff options, modifying the rev_info struct, and then the resulting
command may or may not do anything useful with the values. You can even
do:

  git revert --pretty=oneline -p --date=iso --renames $sha1

all of which is equivalent to just:

  git revert $sha1

So yeah, it's a bug, but it is a known one. The trouble is that fixing
it means splitting the revision options into a set of "these are OK for
picking a revision or range of revisions" and "other options", and
letting commands like revert use one set but not the other. And I'm not
even sure if that distinction is sufficient for all of the commands that
use setup_revisions.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG?] git revert option parsing too lenient?
  2011-05-11 20:36 ` Jeff King
@ 2011-05-11 20:44   ` Sverre Rabbelier
  2011-05-11 20:48     ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Sverre Rabbelier @ 2011-05-11 20:44 UTC (permalink / raw)
  To: Jeff King; +Cc: Git List

Heya,

On Wed, May 11, 2011 at 22:36, Jeff King <peff@peff.net> wrote:
> So yeah, it's a bug, but it is a known one. The trouble is that fixing
> it means splitting the revision options into a set of "these are OK for
> picking a revision or range of revisions" and "other options", and
> letting commands like revert use one set but not the other.

Doing the splitting doesn't sound that hard, I assume the real problem
is getting the option parser to look through both tables?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG?] git revert option parsing too lenient?
  2011-05-11 20:44   ` Sverre Rabbelier
@ 2011-05-11 20:48     ` Jeff King
  2011-05-11 20:51       ` Sverre Rabbelier
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2011-05-11 20:48 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Git List

On Wed, May 11, 2011 at 10:44:48PM +0200, Sverre Rabbelier wrote:

> On Wed, May 11, 2011 at 22:36, Jeff King <peff@peff.net> wrote:
> > So yeah, it's a bug, but it is a known one. The trouble is that fixing
> > it means splitting the revision options into a set of "these are OK for
> > picking a revision or range of revisions" and "other options", and
> > letting commands like revert use one set but not the other.
> 
> Doing the splitting doesn't sound that hard, I assume the real problem
> is getting the option parser to look through both tables?

No, it wouldn't be that hard. You'd split handle_revision_opt into two
functions, and then probably callers of setup_revisions would pass in a
flag to say whether which subset they were interested in.

Maybe the splitting isn't hard. But I suspect it is one of those "the
devil is in the details" tasks where you will find that the options do
not fit as plainly into categories as you want. But I might be wrong.
And I don't want to discourage you from trying to work on it. :)

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG?] git revert option parsing too lenient?
  2011-05-11 20:48     ` Jeff King
@ 2011-05-11 20:51       ` Sverre Rabbelier
  0 siblings, 0 replies; 5+ messages in thread
From: Sverre Rabbelier @ 2011-05-11 20:51 UTC (permalink / raw)
  To: Jeff King; +Cc: Git List

Heya,

On Wed, May 11, 2011 at 22:48, Jeff King <peff@peff.net> wrote:
> And I don't want to discourage you from trying to work on it. :)

Who knows, maybe I'll have some time to work on git(-remote-hg) sometime :).

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-11 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11 10:40 [BUG?] git revert option parsing too lenient? Sverre Rabbelier
2011-05-11 20:36 ` Jeff King
2011-05-11 20:44   ` Sverre Rabbelier
2011-05-11 20:48     ` Jeff King
2011-05-11 20:51       ` Sverre Rabbelier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).