Re: [PATCH 2/3] builtins: utilize startup_info->help where possible
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 19, 2010, 17:29 UTC
- Message-ID
- <20101019172953.GC25139@burratino>
- In-Reply-To
- <1287495320-27278-2-git-send-email-pclouds@gmail.com>
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.
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?
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?