]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3203-branch-output.sh
Merge branch 'js/range-diff-wo-dotdot'
[thirdparty/git.git] / t / t3203-branch-output.sh
index b945faf4702ee35800a36acf2ec5b2ceca16a4c7..b6fcd017afe9d9bdcb470071b849d69322ba5443 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 
 test_description='git branch display tests'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
@@ -210,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
@@ -218,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
 '