tag, branch, for-each-ref: add --ignore-case for sorting and filtering
This options makes sorting ignore case, which is great when you have branches named bug-12-do-something, Bug-12-do-some-more and BUG-12-do-what and want to group them together. Sorting externally may not be an option because we lose coloring and column layout from git-branch and git-tag. The same could be said for filtering, but it's probably less important because you can always go with the ugly pattern [bB][uU][gG]-* if you're desperate. You can't have case-sensitive filtering and case-insensitive sorting (or the other way around) with this though. For branch and tag, that should be no problem. for-each-ref, as a plumbing, might want finer control. But we can always add --{filter,sort}-ignore-case when there is a need for it. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
454cb6bd52
commit
3bb16a8bf2
@ -89,6 +89,11 @@ test_expect_success 'git branch --list -v pattern shows branch summaries' '
|
||||
awk "{print \$NF}" <tmp >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
test_expect_success 'git branch --ignore-case --list -v pattern shows branch summaries' '
|
||||
git branch --list --ignore-case -v BRANCH* >tmp &&
|
||||
awk "{print \$NF}" <tmp >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'git branch -v pattern does not show branch summaries' '
|
||||
test_must_fail git branch -v branch*
|
||||
@ -196,4 +201,28 @@ test_expect_success 'local-branch symrefs shortened properly' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'sort branches, ignore case' '
|
||||
(
|
||||
git init sort-icase &&
|
||||
cd sort-icase &&
|
||||
test_commit initial &&
|
||||
git branch branch-one &&
|
||||
git branch BRANCH-two &&
|
||||
git branch --list | awk "{print \$NF}" >actual &&
|
||||
cat >expected <<-\EOF &&
|
||||
BRANCH-two
|
||||
branch-one
|
||||
master
|
||||
EOF
|
||||
test_cmp expected actual &&
|
||||
git branch --list -i | awk "{print \$NF}" >actual &&
|
||||
cat >expected <<-\EOF &&
|
||||
branch-one
|
||||
BRANCH-two
|
||||
master
|
||||
EOF
|
||||
test_cmp expected actual
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user