aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-27 14:33:42 -0700
committerJunio C Hamano <gitster@pobox.com>2018-08-27 14:33:42 -0700
commitd89db6f4c3fceea7bc9e66823c7a04920e95ac1d (patch)
treebafdcec28f0fd91ad921d331e611b7836ed109cc /t
parent9b7373257740e2eeeb6593261f4af29caba2ba9f (diff)
parent560ae1c164ad040a389ccc47834dce8c15447294 (diff)
downloadgit-d89db6f4c3fceea7bc9e66823c7a04920e95ac1d.tar.xz
Merge branch 'sm/branch-sort-config'
"git branch --list" learned to take the default sort order from the 'branch.sort' configuration variable, just like "git tag --list" pays attention to 'tag.sort'. * sm/branch-sort-config: branch: support configuring --sort via .gitconfig
Diffstat (limited to 't')
-rwxr-xr-xt/t3200-branch.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index dbca665da4..93f21ab078 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -1305,4 +1305,50 @@ test_expect_success 'tracking with unexpected .fetch refspec' '
)
'
+test_expect_success 'configured committerdate sort' '
+ git init sort &&
+ (
+ cd sort &&
+ git config branch.sort committerdate &&
+ test_commit initial &&
+ git checkout -b a &&
+ test_commit a &&
+ git checkout -b c &&
+ test_commit c &&
+ git checkout -b b &&
+ test_commit b &&
+ git branch >actual &&
+ cat >expect <<-\EOF &&
+ master
+ a
+ c
+ * b
+ EOF
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'option override configured sort' '
+ (
+ cd sort &&
+ git config branch.sort committerdate &&
+ git branch --sort=refname >actual &&
+ cat >expect <<-\EOF &&
+ a
+ * b
+ c
+ master
+ EOF
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'invalid sort parameter in configuration' '
+ (
+ cd sort &&
+ git config branch.sort "v:notvalid" &&
+ test_must_fail git branch
+ )
+'
+
test_done