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

[PATCH 4/4] name-rev: ease up condition

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Jul 29, 2013, 19:49 UTC
Message-ID
<1375127398-31904-5-git-send-email-stefanbeller@googlemail.com>
In-Reply-To
<1375127398-31904-1-git-send-email-stefanbeller@googlemail.com>

Now that the internal variables 'all' and 'transform_stdin' are read in by OPT_BOOL, which makes sure to have the variable being 0 or 1 after reading, we do not need the double negation to map any other value to 1.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 builtin/name-rev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index a908a34..20fcf8c 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -331,7 +331,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
 
 	git_config(git_default_config, NULL);
 	argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
-	if (!!all + !!transform_stdin + !!argc > 1) {
+	if (all + transform_stdin + !!argc > 1) {
 		error("Specify either a list, or --all, not both!");
 		usage_with_options(name_rev_usage, opts);
 	}
-- 
1.8.4.rc0.1.g8f6a3e5
Previous: Stefan Beller
Message 7 of 7 in “Removing deprecated parsing macros”
  1. 0/4 Removing deprecated parsing macrosStefan Beller, Jul 29, 2013
  2. 1/4 Replace deprecated OPT_BOOLEAN by OPT_BOOLStefan Beller, Jul 29, 2013
  3. 2/4 log, format-patch: accept short parameter 'q' for quietStefan Beller, Jul 29, 2013
  4. René ScharfeJul 29, 2013
  5. Stefan BellerJul 31, 2013
  6. 3/4 checkout: remove superfluous local variableStefan Beller, Jul 29, 2013
  7. 4/4 name-rev: ease up conditionStefan Beller, Jul 29, 2013

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.