summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2014-07-16 21:48:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-17 16:22:20 (GMT)
commitb150794dafb0a7a1c5caba6fdf7d517a1a15cb59 (patch)
treec9be5e6f007751afc160a475fa96040ea048f471 /t
parentdc662d449f56cb969025db4fe54fa3374777495c (diff)
downloadgit-b150794dafb0a7a1c5caba6fdf7d517a1a15cb59.zip
git-b150794dafb0a7a1c5caba6fdf7d517a1a15cb59.tar.gz
git-b150794dafb0a7a1c5caba6fdf7d517a1a15cb59.tar.bz2
tag: support configuring --sort via .gitconfig
Add support for configuring default sort ordering for git tags. Command line option will override this configured value, using the exact same syntax. Cc: Jeff King <peff@peff.net> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7004-tag.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 66010b0..0366653 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -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 && "$@")
}