From add97702ed7cc3aa57b15c50b72606eb2f2f8cf5 Mon Sep 17 00:00:00 2001 From: Alexandr Miloslavskiy Date: Wed, 6 Nov 2019 15:51:13 +0000 Subject: parse-options.h: add new options `--pathspec-from-file`, `--pathspec-file-nul` Support for various porcelain commands will arrive via additional patches. `--pathspec-from-file` solves the problem of commandline length limit for UIs built on top of git. Plumbing commands are not always a good fit, for two major reasons: 1) Some UIs show executed commands to user. In this case, porcelain commands are expected. One reason for that is letting user learn git commands by clicking UI buttons. The other reason is letting user study the history of commands in case of any unexpected results. Both of these will lose most of their value if UI uses combinations of arcane plumbing commands. 2) Some UIs have started and grown with porcelain commands. Replacing existing logic with plumbing commands could be cumbersome and prone to various new problems. `--pathspec-from-file` will behave very close to pathspec passed in commandline args, so that switching from one to another is simple. `--pathspec-from-file` will read either a specified file or `stdin` (when file is exactly "-"). Reading from file is a good way to avoid competing for `stdin`, and also gives some extra flexibility. `--pathspec-file-nul` switch mirrors `-z` already used in various places. Some porcelain commands, such as `git commit`, already use `-z`, therefore it needed a new unambiguous name. New options do not have shorthands to avoid shorthand conflicts. It is not expected that they will be typed in console. Signed-off-by: Alexandr Miloslavskiy Signed-off-by: Junio C Hamano --- parse-options.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'parse-options.h') diff --git a/parse-options.h b/parse-options.h index 38a33a087e..c6cc01e715 100644 --- a/parse-options.h +++ b/parse-options.h @@ -330,5 +330,7 @@ int parse_opt_passthru_argv(const struct option *, const char *, int); #define OPT_WITH(v, h) _OPT_CONTAINS_OR_WITH("with", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG) #define OPT_WITHOUT(v, h) _OPT_CONTAINS_OR_WITH("without", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG) #define OPT_CLEANUP(v) OPT_STRING(0, "cleanup", v, N_("mode"), N_("how to strip spaces and #comments from message")) +#define OPT_PATHSPEC_FROM_FILE(v) OPT_FILENAME(0, "pathspec-from-file", v, N_("read pathspec from file")) +#define OPT_PATHSPEC_FILE_NUL(v) OPT_BOOL(0, "pathspec-file-nul", v, N_("with --pathspec-from-file, pathspec elements are separated with NUL character")) #endif -- cgit v1.2.3 From 7db03054384e3ab8d50e4b0397b0a8d63f7436e0 Mon Sep 17 00:00:00 2001 From: Heba Waly Date: Sun, 17 Nov 2019 21:04:54 +0000 Subject: parse-options: add link to doc file in parse-options.h Add a link to Documentation/technical/api-parse-options.txt in parse-options.h So the developers would know where to find more info about the API. Signed-off-by: Heba Waly Signed-off-by: Junio C Hamano --- parse-options.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'parse-options.h') diff --git a/parse-options.h b/parse-options.h index 38a33a087e..164ec566b0 100644 --- a/parse-options.h +++ b/parse-options.h @@ -1,6 +1,10 @@ #ifndef PARSE_OPTIONS_H #define PARSE_OPTIONS_H +/** + * Refer to Documentation/technical/api-parse-options.txt for the API doc. + */ + enum parse_opt_type { /* special types */ OPTION_END, -- cgit v1.2.3