summaryrefslogtreecommitdiff
path: root/t/t3203-branch-output.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t3203-branch-output.sh')
-rwxr-xr-xt/t3203-branch-output.sh54
1 files changed, 52 insertions, 2 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index eaa3753..b6fcd01 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -11,6 +11,7 @@ test_expect_success 'make commits' '
echo content >file &&
git add file &&
git commit -m one &&
+ git branch -M main &&
echo content >>file &&
git commit -a -m two
'
@@ -212,7 +213,7 @@ EOF
test_i18ncmp expect actual
'
-test_expect_success 'git branch `--sort` option' '
+test_expect_success 'git branch `--sort=[-]objectsize` option' '
cat >expect <<-\EOF &&
* (HEAD detached from fromtag)
branch-two
@@ -220,6 +221,55 @@ test_expect_success 'git branch `--sort` option' '
main
EOF
git branch --sort=objectsize >actual &&
+ test_i18ncmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ * (HEAD detached from fromtag)
+ branch-one
+ main
+ branch-two
+ EOF
+ git branch --sort=-objectsize >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch `--sort=[-]type` option' '
+ cat >expect <<-\EOF &&
+ * (HEAD detached from fromtag)
+ branch-one
+ branch-two
+ main
+ EOF
+ git branch --sort=type >actual &&
+ test_i18ncmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ * (HEAD detached from fromtag)
+ branch-one
+ branch-two
+ main
+ EOF
+ git branch --sort=-type >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch `--sort=[-]version:refname` option' '
+ cat >expect <<-\EOF &&
+ * (HEAD detached from fromtag)
+ branch-one
+ branch-two
+ main
+ EOF
+ git branch --sort=version:refname >actual &&
+ test_i18ncmp expect actual &&
+
+ cat >expect <<-\EOF &&
+ * (HEAD detached from fromtag)
+ main
+ branch-two
+ branch-one
+ EOF
+ git branch --sort=-version:refname >actual &&
test_i18ncmp expect actual
'
@@ -254,7 +304,7 @@ test_expect_success 'local-branch symrefs shortened properly' '
test_expect_success 'sort branches, ignore case' '
(
- git init sort-icase &&
+ git init -b main sort-icase &&
cd sort-icase &&
test_commit initial &&
git branch branch-one &&