diff options
Diffstat (limited to 't/t3203-branch-output.sh')
-rwxr-xr-x | t/t3203-branch-output.sh | 121 |
1 files changed, 120 insertions, 1 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index ba4f98e800..52283dfc8c 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -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* @@ -96,7 +101,7 @@ test_expect_success 'git branch -v pattern does not show branch summaries' ' test_expect_success 'git branch shows detached HEAD properly' ' cat >expect <<EOF && -* (detached from $(git rev-parse --short HEAD^0)) +* (HEAD detached at $(git rev-parse --short HEAD^0)) branch-one branch-two master @@ -106,4 +111,118 @@ EOF test_i18ncmp expect actual ' +test_expect_success 'git branch shows detached HEAD properly after checkout --detach' ' + git checkout master && + cat >expect <<EOF && +* (HEAD detached at $(git rev-parse --short HEAD^0)) + branch-one + branch-two + master +EOF + git checkout --detach && + git branch >actual && + test_i18ncmp expect actual +' + +test_expect_success 'git branch shows detached HEAD properly after moving' ' + cat >expect <<EOF && +* (HEAD detached from $(git rev-parse --short HEAD)) + branch-one + branch-two + master +EOF + git reset --hard HEAD^1 && + git branch >actual && + test_i18ncmp expect actual +' + +test_expect_success 'git branch shows detached HEAD properly from tag' ' + cat >expect <<EOF && +* (HEAD detached at fromtag) + branch-one + branch-two + master +EOF + git tag fromtag master && + git checkout fromtag && + git branch >actual && + test_i18ncmp expect actual +' + +test_expect_success 'git branch shows detached HEAD properly after moving from tag' ' + cat >expect <<EOF && +* (HEAD detached from fromtag) + branch-one + branch-two + master +EOF + git reset --hard HEAD^1 && + git branch >actual && + test_i18ncmp expect actual +' + +test_expect_success 'git branch `--sort` option' ' + cat >expect <<-\EOF && + * (HEAD detached from fromtag) + branch-two + branch-one + master + EOF + git branch --sort=objectsize >actual && + test_i18ncmp expect actual +' + +test_expect_success 'git branch --points-at option' ' + cat >expect <<-\EOF && + branch-one + master + EOF + git branch --points-at=branch-one >actual && + test_cmp expect actual +' + +test_expect_success 'ambiguous branch/tag not marked' ' + git tag ambiguous && + git branch ambiguous && + echo " ambiguous" >expect && + git branch --list ambiguous >actual && + test_cmp expect actual +' + +test_expect_success 'local-branch symrefs shortened properly' ' + git symbolic-ref refs/heads/ref-to-branch refs/heads/branch-one && + git symbolic-ref refs/heads/ref-to-remote refs/remotes/origin/branch-one && + cat >expect <<-\EOF && + ref-to-branch -> branch-one + ref-to-remote -> refs/remotes/origin/branch-one + EOF + git branch >actual.raw && + grep ref-to <actual.raw >actual && + 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 |