2010/10/20 Jonathan Nieder <jrnieder@xxxxxxxxx>: > Nguyán ThÃi Ngác Duy wrote: > >> It helps reduce false alarms while I'm looking for "git foo -h" code >> path that accesses repository. > > Not sure I understand. ÂIs the idea that use of startup_info->help > is a marker for "I've checked this code path"? > > If that were the only reason, I don't think I'd like the idea. That. And simpler check. I mean "if (startup_info->help)" takes a tiny bit less energy for me to understand than "if (argc == 2 && argv[1] == "-h")". It's also good for grepping. > As it is, I'm a bit conflicted: what if we decide to short-circuit > "git foo --help-all" in the future just like we short-circuit > "git foo -h" now? ÂWould that require a separate flag? As long as it's help related, startup_info->help can be turned to a bit set. Although I'm not sure if --help-all or any other option will be implemented anytime soon. Remember it has to be implemented for _all_ builtin commands, or we need to introduce NO_DASH_H in run_builtin() to skip the shortcut for commands that do not support it. > In other words, I'm not sure startup_info->help is a good abstraction. > Maybe (modulo names) it would be better to do > > struct startup_info { > Â Â Â Â... > Â Â Â Âconst char *short_circuit; Â Â Â/* "-h", "--help-all", "--no-index", or NULL */ > }; > > and use > > Â Â Â Âif (!strcmp(startup_info->short_circuit, "-h")) > > to allow relaxing the argc == 2 check later? Can it be relaxed later when someone comes up with "--help-all" or something? -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html