It's possible to have an "optional" argument by using the PARSE_OPT_OPTARG flag. However, it is not backwards compatible from the user's perspective, as they must use the "sticked" form:
git format-patch -ooutdir ...
to specify the argument. Otherwise, it is not clear in:
git format-patch -o outdir HEAD~
whether "outdir" is the argument to "-o", or if it is simply the next argument.
However, if you are just interested in "turning off" a previously given argument, we usually spell that with the "--no-" prefix to the long option (e.g., "--no-output-directory" in this case).
I'm not clear how that interacts with your example, though. Your example tries to use "-o" to set output_directory to NULL. But it is already NULL if you do not specify any "-o" at all.