diff options
author | Frank Lichtenheld <frank@lichtenheld.de> | 2007-06-25 18:03:55 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-27 06:00:39 +0400 |
commit | 2275d502114c71045af991697048191fed88aac4 (patch) | |
tree | 32bd976eed6f81d7afa538be7d9f03144c9101a6 /t/t1300-repo-config.sh | |
parent | 68fb4650497d6acbf6d407513cd2e2d960442e3b (diff) |
config: Add --null/-z option for null-delimted output
Use \n as delimiter between key and value and \0 as
delimiter after each key/value pair. This should be
easily parsable output.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-x | t/t1300-repo-config.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 84977355a3..7a77bef4c0 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -519,4 +519,36 @@ git config --list > result test_expect_success 'value continued on next line' 'cmp result expect' +cat > .git/config <<\EOF +[section "sub=section"] + val1 = foo=bar + val2 = foo\nbar + val3 = \n\n + val4 = + val5 +EOF + +cat > expect <<\EOF +Key: section.sub=section.val1 +Value: foo=bar +Key: section.sub=section.val2 +Value: foo +bar +Key: section.sub=section.val3 +Value: + + +Key: section.sub=section.val4 +Value: +Key: section.sub=section.val5 +EOF + +git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result + +test_expect_success '--null --list' 'cmp result expect' + +git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result + +test_expect_success '--null --get-regexp' 'cmp result expect' + test_done |