rewrite git_config() to use the config-set API
[gitweb.git] / t / t7004-tag.sh
index 66010b0e7066478da4d3a0a0841fafe45b21c96b..0366653088417a3d694856538bb1d1bd35d36cda 100755 (executable)
@@ -1423,6 +1423,42 @@ test_expect_success 'reverse lexical sort' '
        test_cmp expect actual
 '
 
+test_expect_success 'configured lexical sort' '
+       git config tag.sort "v:refname" &&
+       git tag -l "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.3
+       foo1.6
+       foo1.10
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'option override configured sort' '
+       git tag -l --sort=-refname "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.6
+       foo1.3
+       foo1.10
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'invalid sort parameter on command line' '
+       test_must_fail git tag -l --sort=notvalid "foo*" >actual
+'
+
+test_expect_success 'invalid sort parameter in configuratoin' '
+       git config tag.sort "v:notvalid" &&
+       git tag -l "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.10
+       foo1.3
+       foo1.6
+       EOF
+       test_cmp expect actual
+'
+
 run_with_limited_stack () {
        (ulimit -s 64 && "$@")
 }