git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 13/14] diff.c: convert -W|--[no-]function-context

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 27, 2019, 00:35 UTC
Message-ID
<20190127003535.28341-14-pclouds@gmail.com>
In-Reply-To
<20190127003535.28341-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/diff.c b/diff.c
index 093158244e..8f70101362 100644
--- a/diff.c
+++ b/diff.c
@@ -4896,6 +4896,8 @@ static void prep_parse_options(struct diff_options *options)
 		OPT_CALLBACK_F('U', "unified", options, N_("<n>"),
 			       N_("generate diffs with <n> lines context"),
 			       PARSE_OPT_NONEG, diff_opt_unified),
+		OPT_BOOL('W', "function-context", &options->flags.funccontext,
+			 N_("generate diffs with <n> lines context")),
 		OPT_END()
 	};
 
@@ -5212,12 +5214,6 @@ int diff_opt_parse(struct diff_options *options,
 	else if (opt_arg(arg, '\0', "inter-hunk-context",
 			 &options->interhunkcontext))
 		;
-	else if (!strcmp(arg, "-W"))
-		options->flags.funccontext = 1;
-	else if (!strcmp(arg, "--function-context"))
-		options->flags.funccontext = 1;
-	else if (!strcmp(arg, "--no-function-context"))
-		options->flags.funccontext = 0;
 	else if ((argcount = parse_long_opt("output", av, &optarg))) {
 		char *path = prefix_filename(prefix, optarg);
 		options->file = xfopen(path, "w");
-- 
2.20.1.560.g70ca8b83ee
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 17 of 19 in “nd/diff-parseopt part 1”
  1. 00/14 nd/diff-parseopt part 1Nguyễn Thái Ngọc Duy, Jan 27, 2019
  2. 01/14 parse-options.h: remove extern on function prototypesNguyễn Thái Ngọc Duy, Jan 27, 2019
  3. 02/14 parse-options: add one-shot modeNguyễn Thái Ngọc Duy, Jan 27, 2019
  4. 03/14 parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWNNguyễn Thái Ngọc Duy, Jan 27, 2019
  5. 04/14 parse-options: add OPT_BITOP()Nguyễn Thái Ngọc Duy, Jan 27, 2019
  6. 05/14 parse-options: stop abusing 'callback' for lowlevel callbacksNguyễn Thái Ngọc Duy, Jan 27, 2019
  7. 06/14 parse-options: avoid magic return codesNguyễn Thái Ngọc Duy, Jan 27, 2019
  8. 07/14 parse-options: allow ll_callback with OPTION_CALLBACKNguyễn Thái Ngọc Duy, Jan 27, 2019
  9. Derrick StoleeApr 15, 2019
  10. Duy NguyenApr 16, 2019
  11. Derrick StoleeApr 16, 2019
  12. 08/14 diff.h: keep forward struct declarations sortedNguyễn Thái Ngọc Duy, Jan 27, 2019
  13. 09/14 diff.h: avoid bit fields in struct diff_flagsNguyễn Thái Ngọc Duy, Jan 27, 2019
  14. 10/14 diff.c: prepare to use parse_options() for parsingNguyễn Thái Ngọc Duy, Jan 27, 2019
  15. 11/14 diff.c: convert -u|-p|--patchNguyễn Thái Ngọc Duy, Jan 27, 2019
  16. 12/14 diff.c: convert -U|--unifiedNguyễn Thái Ngọc Duy, Jan 27, 2019
  17. 13/14 diff.c: convert -W|--[no-]function-contextNguyễn Thái Ngọc Duy, Jan 27, 2019
  18. 14/14 diff.c: convert --rawNguyễn Thái Ngọc Duy, Jan 27, 2019
  19. Junio C HamanoJan 28, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.