Thread (7 messages) flat view 7 messages, 3 authors, 2016-06-15
STALE3750d

Revision rfc of 13 in this series.

Revisions (13)
  1. rfc current
  2. v2 [diff vs current]
  3. v2 [diff vs current]
  4. v3 [diff vs current]
  5. v4 [diff vs current]
  6. v5 [diff vs current]
  7. v6 [diff vs current]
  8. v6 [diff vs current]
  9. v8 [diff vs current]
  10. v9 [diff vs current]
  11. v10 [diff vs current]
  12. v11 [diff vs current]
  13. v13 [diff vs current]

[RFC/PATCH 2/2] config: Add new query functions to the api

From: Tanay Abhra <hidden>
Date: 2016-06-15 23:01:23
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

Add explanations for `git_config_get_string_multi` and `git_config_get_string`
which utilize the config cache for querying in an non callback manner for a
specific variable.

Signed-off-by: Tanay Abhra <redacted>
---
 Documentation/technical/api-config.txt | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff --git a/Documentation/technical/api-config.txt b/Documentation/technical/api-config.txt
index 230b3a0..33b5b90 100644
--- a/Documentation/technical/api-config.txt
+++ b/Documentation/technical/api-config.txt
@@ -77,6 +77,25 @@ To read a specific file in git-config format, use
 `git_config_from_file`. This takes the same callback and data parameters
 as `git_config`.
 
+Querying for specific variables
+-------------------------------
+
+For programs wanting to query for specific variables in a non callback
+manner, the config API provides two functions `git_config_get_string`
+and `git_config_get_string_multi`. They both take a single parameter,
+
+- a variable as the key string for which the corresponding values will
+  be retrieved and returned.
+
+They both read value from an internal cache generated previously from
+reading the config files. `git_config_get_string` returns the value with
+the highest priority(i.e. value in the repo config will be preferred over
+value in user wide config for the same variable).
+
+`git_config_get_string_multi` returns a `string_list` containing all the
+values for that particular variable, sorted in order of increasing
+priority.
+
 Value Parsing Helpers
 ---------------------
 
-- 
1.9.0.GIT
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help