Stephen Boyd wrote: > On 12/01/10 15:31, Jonathan Nieder wrote: >> The motivation is to allow update-index to correctly advertise >> >> --cacheinfo <mode> <object> <path> >> add the specified entry to the index >> >> while abusing PARSE_OPT_NOARG to disallow the "sticked form" >> >> --cacheinfo=<mode> <object> <path> [...] > parse-options should accept both forms of --cacheinfo above if the > option isn't marked PARSE_OPT_NOARG. Marking it NOARG to get rid of the > equals sign in the usage seems wrong when both the equals sign and no > equals sign can be accepted. Just to clarify: the NOARG was not meant to affect the usage message but the actual accepted usage. The idea was that git update-index --cacheinfo=100644 87a8767c87b file.c should be rejected, because if it is accepted that would tempt people to try git update-index --cacheinfo=100644 -q 87a8767c87b file.c which fails. That is, the argument to --cacheinfo is not <mode>, since --cacheinfo takes _three_ arguments and therefore the sticked form sends a wrong message. > I know this is a bit more code, but it also means that we don't have > this approach bite someone else down the line when they make assumptions > about options marked as NOARG not taking arguments. > > We should probably add another check like "if argh is set and > PARSE_OPT_NOARG is true error out" so this can't be done. I agree with your conclusion. Let's drop this patch, and I'll look into adding the check and a PARSE_OPT_NOSTICKED flag. -- 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