branch tests: add to --sort tests
Further stress the --sort callback in ref-filter.c. The implementation
uses certain short-circuiting logic, let's make sure it behaves the
same way on e.g. name & version sort. Improves a test added in
aedcb7dc75 (branch.c: use 'ref-filter' APIs, 2015-09-23).
I don't think all of this output makes sense, but let's test for the
behavior as-is, we can fix bugs in it in a later commit.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
			
			
This commit is contained in:
		 Ævar Arnfjörð Bjarmason
					Ævar Arnfjörð Bjarmason
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							ffdd02a55d
						
					
				
				
					commit
					08bf6a8bc3
				
			| @ -210,7 +210,7 @@ EOF | ||||
| 	test_i18ncmp expect actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'git branch `--sort` option' ' | ||||
| test_expect_success 'git branch `--sort=[-]objectsize` option' ' | ||||
| 	cat >expect <<-\EOF && | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	  branch-two | ||||
| @ -218,6 +218,55 @@ test_expect_success 'git branch `--sort` option' ' | ||||
| 	  main | ||||
| 	EOF | ||||
| 	git branch --sort=objectsize >actual && | ||||
| 	test_i18ncmp expect actual && | ||||
|  | ||||
| 	cat >expect <<-\EOF && | ||||
| 	  branch-one | ||||
| 	  main | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	  branch-two | ||||
| 	EOF | ||||
| 	git branch --sort=-objectsize >actual && | ||||
| 	test_i18ncmp expect actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'git branch `--sort=[-]type` option' ' | ||||
| 	cat >expect <<-\EOF && | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	  branch-one | ||||
| 	  branch-two | ||||
| 	  main | ||||
| 	EOF | ||||
| 	git branch --sort=type >actual && | ||||
| 	test_i18ncmp expect actual && | ||||
|  | ||||
| 	cat >expect <<-\EOF && | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	  branch-one | ||||
| 	  branch-two | ||||
| 	  main | ||||
| 	EOF | ||||
| 	git branch --sort=-type >actual && | ||||
| 	test_i18ncmp expect actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'git branch `--sort=[-]version:refname` option' ' | ||||
| 	cat >expect <<-\EOF && | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	  branch-one | ||||
| 	  branch-two | ||||
| 	  main | ||||
| 	EOF | ||||
| 	git branch --sort=version:refname >actual && | ||||
| 	test_i18ncmp expect actual && | ||||
|  | ||||
| 	cat >expect <<-\EOF && | ||||
| 	  main | ||||
| 	  branch-two | ||||
| 	  branch-one | ||||
| 	* (HEAD detached from fromtag) | ||||
| 	EOF | ||||
| 	git branch --sort=-version:refname >actual && | ||||
| 	test_i18ncmp expect actual | ||||
| ' | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user