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

[PATCH v2 6/9] config.c: Expose git_parse_maybe_bool

From
Dave Borowitz <dborowitz@google.com>
Date
Aug 19, 2015, 15:26 UTC
Message-ID
<1439998007-28719-7-git-send-email-dborowitz@google.com>
In-Reply-To
<1439998007-28719-1-git-send-email-dborowitz@google.com>
Signed-off-by: Dave Borowitz <dborowitz@google.com>
---
 cache.h  | 1 +
 config.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/cache.h b/cache.h
index 6bb7119..95d9594 100644
--- a/cache.h
+++ b/cache.h
@@ -1392,6 +1392,7 @@ extern int git_config_with_options(config_fn_t fn, void *,
 				   int respect_includes);
 extern int git_config_early(config_fn_t fn, void *, const char *repo_config);
 extern int git_parse_ulong(const char *, unsigned long *);
+extern int git_parse_maybe_bool(const char *);
 extern int git_config_int(const char *, const char *);
 extern int64_t git_config_int64(const char *, const char *);
 extern unsigned long git_config_ulong(const char *, const char *);
diff --git a/config.c b/config.c
index 9fd275f..e5d7959 100644
--- a/config.c
+++ b/config.c
@@ -618,7 +618,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
 	return ret;
 }
 
-static int git_config_maybe_bool_text(const char *name, const char *value)
+int git_parse_maybe_bool(const char *value)
 {
 	if (!value)
 		return 1;
@@ -637,7 +637,7 @@ static int git_config_maybe_bool_text(const char *name, const char *value)
 
 int git_config_maybe_bool(const char *name, const char *value)
 {
-	int v = git_config_maybe_bool_text(name, value);
+	int v = git_parse_maybe_bool(value);
 	if (0 <= v)
 		return v;
 	if (git_parse_int(value, &v))
@@ -647,7 +647,7 @@ int git_config_maybe_bool(const char *name, const char *value)
 
 int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
 {
-	int v = git_config_maybe_bool_text(name, value);
+	int v = git_parse_maybe_bool(value);
 	if (0 <= v) {
 		*is_bool = 1;
 		return v;
-- 
2.5.0.276.gf5e568e
Previous: Dave BorowitzNext: Dave Borowitz
Message 11 of 19 in “Flags and config to sign pushes by default”
  1. 0/9 Flags and config to sign pushes by defaultDave Borowitz, Aug 19, 2015
  2. 1/9 Documentation/git-push.txt: Document when --signed may failDave Borowitz, Aug 19, 2015
  3. 2/9 Documentation/git-send-pack.txt: Flow long synopsis lineDave Borowitz, Aug 19, 2015
  4. Junio C HamanoAug 19, 2015
  5. Dave BorowitzAug 19, 2015
  6. Junio C HamanoAug 19, 2015
  7. Junio C HamanoSep 11, 2015
  8. 3/9 Documentation/git-send-pack.txt: Document --signedDave Borowitz, Aug 19, 2015
  9. 4/9 gitremote-helpers.txt: Document pushcert optionDave Borowitz, Aug 19, 2015
  10. 5/9 transport: Remove git_transport_options.push_certDave Borowitz, Aug 19, 2015
  11. 6/9 config.c: Expose git_parse_maybe_boolDave Borowitz, Aug 19, 2015
  12. 7/9 builtin/send-pack.c: Use option parsing APIDave Borowitz, Aug 19, 2015
  13. Stefan BellerAug 19, 2015
  14. Dave BorowitzAug 19, 2015
  15. Jeff KingAug 21, 2015
  16. 8/9 Support signing pushes iff the server supports itDave Borowitz, Aug 19, 2015
  17. Junio C HamanoAug 19, 2015
  18. Dave BorowitzAug 19, 2015
  19. 9/9 Add a config option push.gpgSign for default signed pushesDave Borowitz, Aug 19, 2015

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.