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

[PATCH 1/4] read-tree: use OPT_BOOL instead of OPT_SET_INT

From
Stefan Beller <sbeller@google.com>
Date
Jan 10, 2017, 01:45 UTC
Message-ID
<20170110014542.19352-2-sbeller@google.com>
In-Reply-To
<20170110014542.19352-1-sbeller@google.com>

All occurrences of OPT_SET_INT were setting the value to 1; internally OPT_BOOL is just that.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/read-tree.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index fa6edb35b2..8ba64bc785 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -109,34 +109,34 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 		{ OPTION_CALLBACK, 0, "index-output", NULL, N_("file"),
 		  N_("write resulting index to <file>"),
 		  PARSE_OPT_NONEG, index_output_cb },
-		OPT_SET_INT(0, "empty", &read_empty,
-			    N_("only empty the index"), 1),
+		OPT_BOOL(0, "empty", &read_empty,
+			    N_("only empty the index")),
 		OPT__VERBOSE(&opts.verbose_update, N_("be verbose")),
 		OPT_GROUP(N_("Merging")),
-		OPT_SET_INT('m', NULL, &opts.merge,
-			    N_("perform a merge in addition to a read"), 1),
-		OPT_SET_INT(0, "trivial", &opts.trivial_merges_only,
-			    N_("3-way merge if no file level merging required"), 1),
-		OPT_SET_INT(0, "aggressive", &opts.aggressive,
-			    N_("3-way merge in presence of adds and removes"), 1),
-		OPT_SET_INT(0, "reset", &opts.reset,
-			    N_("same as -m, but discard unmerged entries"), 1),
+		OPT_BOOL('m', NULL, &opts.merge,
+			 N_("perform a merge in addition to a read")),
+		OPT_BOOL(0, "trivial", &opts.trivial_merges_only,
+			 N_("3-way merge if no file level merging required")),
+		OPT_BOOL(0, "aggressive", &opts.aggressive,
+			 N_("3-way merge in presence of adds and removes")),
+		OPT_BOOL(0, "reset", &opts.reset,
+			 N_("same as -m, but discard unmerged entries")),
 		{ OPTION_STRING, 0, "prefix", &opts.prefix, N_("<subdirectory>/"),
 		  N_("read the tree into the index under <subdirectory>/"),
 		  PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP },
-		OPT_SET_INT('u', NULL, &opts.update,
-			    N_("update working tree with merge result"), 1),
+		OPT_BOOL('u', NULL, &opts.update,
+			 N_("update working tree with merge result")),
 		{ OPTION_CALLBACK, 0, "exclude-per-directory", &opts,
 		  N_("gitignore"),
 		  N_("allow explicitly ignored files to be overwritten"),
 		  PARSE_OPT_NONEG, exclude_per_directory_cb },
-		OPT_SET_INT('i', NULL, &opts.index_only,
-			    N_("don't check the working tree after merging"), 1),
+		OPT_BOOL('i', NULL, &opts.index_only,
+			 N_("don't check the working tree after merging")),
 		OPT__DRY_RUN(&opts.dry_run, N_("don't update the index or the work tree")),
-		OPT_SET_INT(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
-			    N_("skip applying sparse checkout filter"), 1),
-		OPT_SET_INT(0, "debug-unpack", &opts.debug_unpack,
-			    N_("debug unpack-trees"), 1),
+		OPT_BOOL(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
+			 N_("skip applying sparse checkout filter")),
+		OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
+			 N_("debug unpack-trees")),
 		OPT_END()
 	};
 
-- 
2.11.0.rc2.30.g7c4be45.dirty
Previous: Stefan BellerNext: Junio C Hamano
Message 2 of 17 in “working tree operations: support superprefix”
  1. 0/4 working tree operations: support superprefixStefan Beller, Jan 10, 2017
  2. 1/4 read-tree: use OPT_BOOL instead of OPT_SET_INTStefan Beller, Jan 10, 2017
  3. Junio C HamanoJan 10, 2017
  4. 3/4 t1001: modernize styleStefan Beller, Jan 10, 2017
  5. 2/4 t1000: modernize styleStefan Beller, Jan 10, 2017
  6. Junio C HamanoJan 10, 2017
  7. Stefan BellerJan 10, 2017
  8. Junio C HamanoJan 10, 2017
  9. 4/4 unpack-trees: support super-prefix optionStefan Beller, Jan 10, 2017
  10. Junio C HamanoJan 11, 2017
  11. Stefan BellerJan 11, 2017
  12. Junio C HamanoJan 11, 2017
  13. Stefan BellerJan 11, 2017
  14. 4/4 unpack-trees: support super-prefix optionStefan Beller, Jan 12, 2017
  15. Junio C HamanoJan 12, 2017
  16. Stefan BellerJan 12, 2017
  17. Brian J. DavisJan 13, 2017

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.