From: Junio C Hamano Date: Sat, 13 May 2006 21:10:48 +0000 (-0700) Subject: Merge branch 'lt/fix-config' into lt/config X-Git-Tag: v1.4.0-rc1~141^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8d48ad62a902556b523ee892a3fbe4206d576d3f;p=git.git Merge branch 'lt/fix-config' into lt/config * lt/fix-config: git config syntax updates Another config file parsing fix. checkout: use --aggressive when running a 3-way merge (-m). Fix git-pack-objects for 64-bit platforms with manual adjustment of t/t1300 for "git repo-config --list" option. Signed-off-by: Junio C Hamano --- 8d48ad62a902556b523ee892a3fbe4206d576d3f diff --cc repo-config.c index 63eda1bb7,58b6c5284..127afd784 --- a/repo-config.c +++ b/repo-config.c @@@ -64,21 -47,15 +64,22 @@@ static int show_config(const char* key_ static int get_value(const char* key_, const char* regex_) { -- int i; + char *tl; - key = malloc(strlen(key_)+1); - for (i = 0; key_[i]; i++) - key[i] = tolower(key_[i]); - key[i] = 0; + key = strdup(key_); + for (tl=key+strlen(key)-1; tl >= key && *tl != '.'; --tl) + *tl = tolower(*tl); + for (tl=key; *tl && *tl != '.'; ++tl) + *tl = tolower(*tl); + if (use_key_regexp) { + key_regexp = (regex_t*)malloc(sizeof(regex_t)); + if (regcomp(key_regexp, key, REG_EXTENDED)) { + fprintf(stderr, "Invalid key pattern: %s\n", key_); + return -1; + } + } + if (regex_) { if (regex_[0] == '!') { do_not_match = 1; diff --cc t/t1300-repo-config.sh index 7090ea92c,028d15956..8260d57b6 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -247,24 -247,6 +247,24 @@@ EO test_expect_success 'hierarchical section value' 'cmp .git/config expect' +cat > expect << EOF +beta.noindent=sillyValue +nextsection.nonewline=wow2 for me +123456.a123=987 - 1.2.3.alpha=beta ++version.1.2.3eX.alpha=beta +EOF + +test_expect_success 'working --list' \ + 'git-repo-config --list > output && cmp output expect' + +cat > expect << EOF +beta.noindent sillyValue +nextsection.nonewline wow2 for me +EOF + +test_expect_success '--get-regexp' \ + 'git-repo-config --get-regexp in > output && cmp output expect' + cat > .git/config << EOF [novalue] variable