Option to exclude items from Git branch checkout list #13506 #16792
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here are my proposed changes to solve issue #13506.. This is an implementation of what @joaomoreno proposed in the ticket.. I've added a setting named
checkoutType
which controls what is listed inside the quick open panel for the git checkout command (all
is as it is today,local
is only local branches,tags
is local branches and tagged commits,remote
is local branches and remote branches... Happy to change names/descriptions of anything :) ).I believe these are the minimal amount of changes to do this. Poking around, I could see a couple other ways you'd do it, either getting the config service into the
CheckoutCommand
(which seemed like a large refactor) or using the setting as a filter on theGitService
for what's exposed asmodel
/head
/refs
(which also seemed like a large refactor and could change other consumers).. If one of those are the desired approach, I think that my changes should be abandoned and someone else would have to take over that effort (as I'm not familiar enough with the larger application).There's still some things I'm unsure of. For example, we could branch inside the
CheckoutCommand
'sgetResult
method instead of using empty arrays fortags
/remoteHeads
(I just thought it added an unnecessary level of complexity). Another example is maybe using a private_checkoutType
on theGitService
and set it as part of theonDidUpdateConfiguration
handler (this would be more similar toallowHugeRepositories
, but since there isn't an override I don't know that it's necessary (and very possible I'm misunderstanding some intents here).. It's also very possible there's other completely different things I overlooked/you guys would know more about.I looked for tests related to either the
CheckoutCommand
or the git settings and had trouble finding anything that I could base things on. If you had any suggestions or places to look at for similar tests, I'd be happy to take a stab at automating something. I did run all local tests and linting and they passed and reported nothing (respectively).I did test this locally with this repo to ensure that 1) The setting existed/had the description and options I expected 2) The drop down respected the settings I picked (and that it updated without restarting) 3) I could still switch branches
Thanks for the great product!
Edit: reread this this morning and noticed I had some bad English in some places.. Also signed the CLA (and got confirmation from it), but the bot hasn't updated this. Is there anything else I should do for that? I wasn't expecting one line for the address, so maybe I messed it up.