mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Add an integration test showing a problem with autosquash during normal rebase
For users who have the rebase.autoSquash git config set to true, any regular rebase will squash fixups in addition to rebasing. Not good -- we'll fix that in the next commit.
This commit is contained in:
		
							
								
								
									
										56
									
								
								pkg/integration/tests/branch/rebase_does_not_autosquash.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								pkg/integration/tests/branch/rebase_does_not_autosquash.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| package branch | ||||
|  | ||||
| import ( | ||||
| 	"github.com/jesseduffield/lazygit/pkg/config" | ||||
| 	. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||||
| ) | ||||
|  | ||||
| var RebaseDoesNotAutosquash = NewIntegrationTest(NewIntegrationTestArgs{ | ||||
| 	Description:  "Rebase a branch that has fixups onto another branch, and verify that the fixups are not squashed even if rebase.autoSquash is enabled globally.", | ||||
| 	ExtraCmdArgs: "", | ||||
| 	Skip:         false, | ||||
| 	SetupConfig:  func(config *config.AppConfig) {}, | ||||
| 	SetupRepo: func(shell *Shell) { | ||||
| 		shell.SetConfig("rebase.autoSquash", "true") | ||||
|  | ||||
| 		shell. | ||||
| 			EmptyCommit("base"). | ||||
| 			NewBranch("my-branch"). | ||||
| 			Checkout("master"). | ||||
| 			EmptyCommit("master commit"). | ||||
| 			Checkout("my-branch"). | ||||
| 			EmptyCommit("branch commit"). | ||||
| 			EmptyCommit("fixup! branch commit") | ||||
| 	}, | ||||
| 	Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||||
| 		t.Views().Commits(). | ||||
| 			Lines( | ||||
| 				Contains("fixup! branch commit"), | ||||
| 				Contains("branch commit"), | ||||
| 				Contains("base"), | ||||
| 			) | ||||
|  | ||||
| 		t.Views().Branches(). | ||||
| 			Focus(). | ||||
| 			Lines( | ||||
| 				Contains("my-branch").IsSelected(), | ||||
| 				Contains("master"), | ||||
| 			). | ||||
| 			SelectNextItem(). | ||||
| 			Press(keys.Branches.RebaseBranch) | ||||
|  | ||||
| 		t.ExpectPopup().Confirmation(). | ||||
| 			Title(Equals("Rebasing")). | ||||
| 			Content(Contains("Are you sure you want to rebase 'my-branch' on top of 'master'?")). | ||||
| 			Confirm() | ||||
|  | ||||
| 		t.Views().Commits().Lines( | ||||
| 			/* Expected the fixup to be kept, but it's gone: | ||||
| 			Contains("fixup! branch commit"), | ||||
| 			*/ | ||||
| 			Contains("branch commit"), | ||||
| 			Contains("master commit"), | ||||
| 			Contains("base"), | ||||
| 		) | ||||
| 	}, | ||||
| }) | ||||
| @@ -37,6 +37,7 @@ var tests = []*components.IntegrationTest{ | ||||
| 	branch.Delete, | ||||
| 	branch.Rebase, | ||||
| 	branch.RebaseAndDrop, | ||||
| 	branch.RebaseDoesNotAutosquash, | ||||
| 	branch.Suggestions, | ||||
| 	branch.Reset, | ||||
| 	branch.DetachedHead, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user