Jeff King <peff@xxxxxxxx> writes: > Much worse, though, is that we also have to interact with "--stdout". We > currently treat "--stdout -o foo" as an error; you need a separate > config_output_directory to continue to handle that (and allow "--stdout" > to override the config). > > If I were designing from scratch, I would consider making "-o -" output > to stdout, and letting it override a previous "-o" (or vice versa). We > could still do that (and make "--stdout" an alias for that), but I don't > know if it is worth the trouble (it does change the behavior for anybody > who wanted a directory called "-", but IMHO it is more likely to save > somebody a headache than create one). I agree with "later -o should override an earlier one", but I do not necessarily agree with "'-o -' should be --stdout", for a simple reason that "-o foo" is not "--stdout >foo". Perhaps something like this to replace builtin/ part of Alexander's patch? builtin/log.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/log.c b/builtin/log.c index e67671e..e022d62 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -682,6 +682,8 @@ enum { COVER_AUTO }; +static const char *config_output_directory; + static int git_format_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "format.headers")) { @@ -752,6 +754,9 @@ static int git_format_config(const char *var, const char *value, void *cb) config_cover_letter = git_config_bool(var, value) ? COVER_ON : COVER_OFF; return 0; } + if (!strcmp(var, "format.outputdirectory")) { + return git_config_string(&config_output_directory, var, value); + } return git_log_config(var, value, cb); } @@ -1337,6 +1342,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) die (_("--subject-prefix and -k are mutually exclusive.")); rev.preserve_subject = keep_subject; + if (!output_directory && !use_stdout) + output_directory = config_output_directory; + argc = setup_revisions(argc, argv, &rev, &s_r_opt); if (argc > 1) die (_("unrecognized argument: %s"), argv[1]); -- 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