Re: [PATCH 07/14] revert: Introduce struct to keep command-line options
From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:51:34
Hi Junio, Again- intended to reply to this earlier; sorry. Junio C Hamano writes:
Ramkumar Ramachandra [off-list ref] writes:quoted
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