Closed Black-Photon closed 4 years ago
Switching to current branch should not be allowed - #57 'metro fix' implements WIP load with metro fix --import-wip
Wouldn't switching to the current branch be easier and more obvious that being forced to use fix
to do exactly the same thing
That's true, but it doesn't correspond with the purpose of the command. We could leave a message specifying the other command, or as you say, do that anyway. But isn't it best to keep commands function corresponding with their purpose?
Perhaps, but one of the main reasons we're making a Git wrapper in the first place is the fact that Git has a habit of making the user run tons of random commands to fix issues. Just switching into the current branch pretty much does what it says on the tin, and may be more intuitive than running some arcane troubleshooting command. Switching into the current branch is a bit like reloading a web page; you could argue that a better way to fix issues on the web would be to open up the JS console and start debugging, or you could just request the entire page again, which, while overkill, gets the job done. I can see your concern about mixing the functionality of commands, but if a user knows that switch
restores WIP branches, and they want to restore the current WIP branch, switching to current might be the most obvious way to do it. Switching into the current branch doesn't really have major negatives anyway, it's just a bit weird. If someone wants to prioritise pedantry over ease of use, they can just use raw Git.
Good point, I guess that's a pretty likely course of action to choose - we can add support for WIP loading then.
Feature Description
Currently, if you are in some branch
branch
and you runmetro switch branch
, it will check it out as normal. However,git
does not do this, and there is no reason for Metro to either. Metro should detect the branch is the current branch and not check the branch out.However, this also would then prevent checking out the current branch WIP if the WIP was not loaded. Thus either
metro switch branch
should still load the WIP while not checking out, or a separate command should exist to force-load the WIP.Expected Behaviour