Re: [PATCH 07/14] revert: Introduce struct to keep command-line options
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jul 12, 2011, 06:21 UTC
- Message-ID
- <CALkWK0mxXwvurJzDOYOdXS33cb563WnKmG1_cue6F4pgqOU_WQ@mail.gmail.com>
- In-Reply-To
- <7vzkkrjec2.fsf@alter.siamese.dyndns.org>
Hi Junio,
Again- intended to reply to this earlier; sorry.
Junio C Hamano writes:
Show 10 quoted lines
> Ramkumar Ramachandra <artagnon@gmail.com> writes: >> The variable "me" is left as a file-scope static variable because it >> is not an independent option. "me" is simply a string that needs to >> be inferred from the "action" option, and is kept global to save each >> function the trouble of determining it independently. > > Would it make more sense to remove the variable, pass "action" around > where only "me" is passed around right now, and introduce a function > "static const char *action_name()" to help places that wants textual > command name for display purposes?
Okay, let me put it like this: "me" exists because cherry-pick and revert functionalities are mixed in the same file; builtin/revert.c. In future, the sequencer in general will support many more actions -- and we will definitely require an "opts->action to instruction sheet keyword" translation, and that'll probably be some sort of struct. Since I'm not sure the function you propose will make it to sequencer.c, I don't want to introduce it now. Let's wait and see how it shapes up.
Thanks.
-- Ram