unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.64k stars 267 forks source link

regression in switch remembering last branch for project #5081

Closed ceedubs closed 6 days ago

ceedubs commented 2 weeks ago

Describe and demonstrate the bug

In ucm 0.5.20, if you used switch to switch to a project without a branch name, it would remember the last branch that you were on within that project. But in ucm 0.5.21 (and current trunk), it switches you to the main branch regardless of which branch you were previously using in the project that you are switching to.

Screenshots

ghc-shell-for-packages-env ❯ /nix/store/0hpd6hv3kai70067vzhss6k5hy8gjh23-unison-code-manager-0.5.20/bin/ucm                                                                                                                                                                     

  Now starting the Unison Codebase Manager (UCM)...                                                                                                                                                                                           

   _____     _                                                                                                                                                                                                                                
  |  |  |___|_|___ ___ ___                                                                                                                                                                                                                    
  |  |  |   | |_ -| . |   |                                                                                                                                                                                                                   
  |_____|_|_|_|___|___|_|_|                                                                                                                                                                                                                   

  👋 Welcome to Unison!                                                                                                                                                                                                                       

  You are running version: release/0.5.20                                                                                                                                                                                                     

  📚 Read the official docs at https://www.unison-lang.org/docs/                                                                                                                                                                              

  Hint: Type 'projects' to list all your projects, or 'project.create' to start something new.                                                                                                                                                

@unison/base/main> switch testing                                                                                                                                                                                                             
@unison/base/testing> switch                                                                                                                                                                                                                  
Select a project or branch to switch to:                                                                                                                                                                                                      
@unison/base/testing> switch @unison/http                                                                                                                                                                                                     
@unison/http/main> switch                                                                                                                                                                                                                     
Select a project or branch to switch to:                                                                                                                                                                                                      
@unison/http/main> switch @unison/base                                                                                                                                                                                                        
@unison/base/testing>                                                                                                                                                                                                                         

~/code/unison trunk* 44s                                            
ghc-shell-for-packages-env ❯ /nix/store/dwxvb8jx7bcjq03r6qjnri65dqxi1n1p-unison-code-manager-0.5.21/bin/ucm                             

  Now starting the Unison Codebase Manager (UCM)...                 

   _____     _                                                      
  |  |  |___|_|___ ___ ___                                          
  |  |  |   | |_ -| . |   |                                         
  |_____|_|_|_|___|___|_|_|                                         

  👋 Welcome to Unison!                                             

  You are running version: release/0.5.21                           

  📚 Read the official docs at https://www.unison-lang.org/docs/                                                                        

  Hint: Type 'projects' to list all your projects, or 'project.create' to start something new.                                          

@unison/base/testing> switch                                        
Select a project or branch to switch to:                            
@unison/base/testing> switch @unison/http                           
@unison/http/main> switch                                           
Select a project or branch to switch to:                            
@unison/http/main> switch @unison/base                              
@unison/base/main>

Environment (please complete the following information):

stew commented 2 weeks ago

I bisected this:

49ee64ef37fb3846d8aee8858435dc054d9992e3 is the first bad commit
commit 49ee64ef37fb3846d8aee8858435dc054d9992e3
Author: Mitchell Rosen <mitchellwrosen@gmail.com>
Date:   Mon May 20 10:45:27 2024 -0400

    sketch out basic `upgrade.commit` command

 unison-cli/src/Unison/Cli/ProjectUtils.hs          | 15 ++++++
 .../Unison/Codebase/Editor/HandleInput/Branch.hs   |  3 +-
 .../Codebase/Editor/HandleInput/CommitUpgrade.hs   | 28 ++++++++++
 .../Codebase/Editor/HandleInput/ProjectSwitch.hs   | 62 +++++++++++-----------
 unison-cli/unison-cli.cabal                        |  1 +
 5 files changed, 75 insertions(+), 34 deletions(-)
 create mode 100644 unison-cli/src/Unison/Codebase/Editor/HandleInput/CommitUpgrade.hs