diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-04-06 13:38:21 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-04-06 13:38:21 -0700 |
| commit | 7727da99dfab82148c5b77eaf334b305fb835956 (patch) | |
| tree | 99ea4038ce40c89d09592a94a715b642160216a8 /t/t3203-branch-output.sh | |
| parent | ae73b2c8f1da39c39335ee76a0f95857712c22a7 (diff) | |
| parent | cbfe360b140fe92d9c4a763bf630c3b8ba431522 (diff) | |
| download | git-7727da99dfab82148c5b77eaf334b305fb835956.tar.gz | |
Merge branch 'ds/ahead-behind'
"git for-each-ref" learns '%(ahead-behind:<base>)' that computes the
distances from a single reference point in the history with bunch
of commits in bulk.
* ds/ahead-behind:
commit-reach: add tips_reachable_from_bases()
for-each-ref: add ahead-behind format atom
commit-reach: implement ahead_behind() logic
commit-graph: introduce `ensure_generations_valid()`
commit-graph: return generation from memory
commit-graph: simplify compute_generation_numbers()
commit-graph: refactor compute_topological_levels()
for-each-ref: explicitly test no matches
for-each-ref: add --stdin option
Diffstat (limited to 't/t3203-branch-output.sh')
| -rwxr-xr-x | t/t3203-branch-output.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index d34d77f893..1c0f7ea24e 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -337,6 +337,20 @@ test_expect_success 'git branch --format option' ' test_cmp expect actual ' +test_expect_success 'git branch --format with ahead-behind' ' + cat >expect <<-\EOF && + (HEAD detached from fromtag) 0 0 + refs/heads/ambiguous 0 0 + refs/heads/branch-one 1 0 + refs/heads/branch-two 0 0 + refs/heads/main 1 0 + refs/heads/ref-to-branch 1 0 + refs/heads/ref-to-remote 1 0 + EOF + git branch --format="%(refname) %(ahead-behind:HEAD)" >actual && + test_cmp expect actual +' + test_expect_success 'git branch with --format=%(rest) must fail' ' test_must_fail git branch --format="%(rest)" >actual ' |
