diff options
author | Samuel Maftoul <samuel.maftoul@gmail.com> | 2018-08-16 12:35:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-16 21:17:10 +0300 |
commit | 560ae1c164ad040a389ccc47834dce8c15447294 (patch) | |
tree | ff10bf3737823e15698fabb29c4e0928321eda50 /t/t3200-branch.sh | |
parent | 63749b2dea5d1501ff85bab7b8a7f64911d21dea (diff) |
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/t3200-branch.sh')
-rwxr-xr-x | t/t3200-branch.sh | 46 |
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 |