summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSamuel Maftoul <samuel.maftoul@gmail.com>2018-08-16 09:35:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-16 18:17:10 (GMT)
commit560ae1c164ad040a389ccc47834dce8c15447294 (patch)
treeff10bf3737823e15698fabb29c4e0928321eda50 /t
parent63749b2dea5d1501ff85bab7b8a7f64911d21dea (diff)
downloadgit-560ae1c164ad040a389ccc47834dce8c15447294.zip
git-560ae1c164ad040a389ccc47834dce8c15447294.tar.gz
git-560ae1c164ad040a389ccc47834dce8c15447294.tar.bz2
branch: support configuring --sort via .gitconfig
Add support for configuring default sort ordering for git branches. Command line option will override this configured value, using the exact same syntax. Signed-off-by: Samuel Maftoul <samuel.maftoul@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 dbca665..93f21ab 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