t2060: add a test for switch with --orphan and --discard-changes
We have several code paths in the checkout code which are traversed only in this case, due to switch having different defaults from checkout. Let's add a test that the combination of options works and produces the expected behavior. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 brian m. carlson
					brian m. carlson
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							81861288a9
						
					
				
				
					commit
					8d3e33dadd
				
			| @ -68,6 +68,14 @@ test_expect_success 'new orphan branch from empty' ' | ||||
| 	test_cmp expected tracked-files | ||||
| ' | ||||
|  | ||||
| test_expect_success 'orphan branch works with --discard-changes' ' | ||||
| 	test_when_finished git switch master && | ||||
| 	echo foo >foo.txt && | ||||
| 	git switch --discard-changes --orphan new-orphan2 && | ||||
| 	git ls-files >tracked-files && | ||||
| 	test_must_be_empty tracked-files | ||||
| ' | ||||
|  | ||||
| test_expect_success 'switching ignores file of same branch name' ' | ||||
| 	test_when_finished git switch master && | ||||
| 	: >first-branch && | ||||
|  | ||||
		Reference in New Issue
	
	Block a user