summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-23 18:35:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-23 18:35:45 (GMT)
commitc3d2bc720cd56af5a18eec219890dcff701680f8 (patch)
tree47abe35663b14edb6a1b0725d8e70a63959e1087 /t
parent247b4d5f3807dc3c2230bb4bf497f84a1fc59e49 (diff)
parentb150794dafb0a7a1c5caba6fdf7d517a1a15cb59 (diff)
downloadgit-c3d2bc720cd56af5a18eec219890dcff701680f8.zip
git-c3d2bc720cd56af5a18eec219890dcff701680f8.tar.gz
git-c3d2bc720cd56af5a18eec219890dcff701680f8.tar.bz2
Merge branch 'jk/tag-sort'
* jk/tag-sort: tag: support configuring --sort via .gitconfig tag: fix --sort tests to use cat<<-\EOF format
Diffstat (limited to 't')
-rwxr-xr-xt/t7004-tag.sh76
1 files changed, 56 insertions, 20 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index e4ab0f5..0366653 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1385,41 +1385,77 @@ test_expect_success 'lexical sort' '
git tag foo1.6 &&
git tag foo1.10 &&
git tag -l --sort=refname "foo*" >actual &&
- cat >expect <<EOF &&
-foo1.10
-foo1.3
-foo1.6
-EOF
+ cat >expect <<-\EOF &&
+ foo1.10
+ foo1.3
+ foo1.6
+ EOF
test_cmp expect actual
'
test_expect_success 'version sort' '
git tag -l --sort=version:refname "foo*" >actual &&
- cat >expect <<EOF &&
-foo1.3
-foo1.6
-foo1.10
-EOF
+ cat >expect <<-\EOF &&
+ foo1.3
+ foo1.6
+ foo1.10
+ EOF
test_cmp expect actual
'
test_expect_success 'reverse version sort' '
git tag -l --sort=-version:refname "foo*" >actual &&
- cat >expect <<EOF &&
-foo1.10
-foo1.6
-foo1.3
-EOF
+ cat >expect <<-\EOF &&
+ foo1.10
+ foo1.6
+ foo1.3
+ EOF
test_cmp expect actual
'
test_expect_success 'reverse lexical sort' '
git tag -l --sort=-refname "foo*" >actual &&
- cat >expect <<EOF &&
-foo1.6
-foo1.3
-foo1.10
-EOF
+ cat >expect <<-\EOF &&
+ foo1.6
+ foo1.3
+ foo1.10
+ EOF
+ 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
'