summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-03 17:29:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-03 17:29:26 (GMT)
commitc832cef8aa541cce6e2a53a4e1e466bfe8323531 (patch)
tree862607c5e50a1b1ea9ea542ccb86c9fd8e431465 /builtin
parent2052c52d9a16fe1d9a091dd0b53ab1806a663999 (diff)
parent24990b2febec5e00ecc8c7c57614b7431b86f7a5 (diff)
downloadgit-c832cef8aa541cce6e2a53a4e1e466bfe8323531.zip
git-c832cef8aa541cce6e2a53a4e1e466bfe8323531.tar.gz
git-c832cef8aa541cce6e2a53a4e1e466bfe8323531.tar.bz2
Merge branch 'jk/config-get-urlmatch'
"git config --get-urlmatch", unlike other variants of the "git config --get" family, did not signal error with its exit status when there was no matching configuration. * jk/config-get-urlmatch: Documentation/git-config: fix --get-all description Documentation/git-config: use bulleted list for exit codes config: fail if --get-urlmatch finds no value
Diffstat (limited to 'builtin')
-rw-r--r--builtin/config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/config.c b/builtin/config.c
index ca9f834..1d7c6ef 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -417,6 +417,7 @@ static int urlmatch_collect_fn(const char *var, const char *value, void *cb)
static int get_urlmatch(const char *var, const char *url)
{
+ int ret;
char *section_tail;
struct string_list_item *item;
struct urlmatch_config config = { STRING_LIST_INIT_DUP };
@@ -443,6 +444,8 @@ static int get_urlmatch(const char *var, const char *url)
git_config_with_options(urlmatch_config_entry, &config,
&given_config_source, respect_includes);
+ ret = !values.nr;
+
for_each_string_list_item(item, &values) {
struct urlmatch_current_candidate_value *matched = item->util;
struct strbuf buf = STRBUF_INIT;
@@ -459,7 +462,7 @@ static int get_urlmatch(const char *var, const char *url)
free(config.url.url);
free((void *)config.section);
- return 0;
+ return ret;
}
static char *default_user_config(void)