Closed part22 closed 3 days ago
Before I start reviewing this: do we actually need it? In #3675 my suggestion was to never set up tracking when pressing n
, letting people use space
(or press c
in the local branches panel to checkout by name) if they do want a tracking branch. Jesse agreed. This is much simpler, so I prefer that solution.
I'm not too worried about the added code complexity, but I am concerned about adding config options that we don't absolutely need. We have so many options already, it just makes it harder to find the really important ones among them.
I could just disable the tracking when using the n
keybinding but I think it's always tricky to remove something people might have got used to.
But you and Jesse know the software and the codebase better than I do, so I will defer to your good judgement! đ
You mean people who are used to pressing n enter
to create a tracking branch? How about we keep your logic of setting the tracking branch only if the name matches, but not if it doesn't? This should cover that case but also address the problem raised in #3675. Just without the configurability. What do you think?
That seems like a good compromise but if you feel that is still too much added complexity I am fine with just disabling the tracking when using n
on remote branches.
No, I like this middle-ground version best. It's just so unlikely that someone wants to create a branch that has the same name but does not track the remote. As I said, the added code complexity doesn't bother me so much.
I have removed the configuration part and kept the new behaviour part.
Current Behaviour | New Behaviour |
---|---|
Local branches will always track the remote branches they were created from. | Local branches will track the remote branches they were created from only if their names match. |
Oh, and it would be good to update the PR description, because it will end up in the merge commit message.
I have updated it.
Thanks! Very happy with the current state. Merging.
(Grr, I keep commenting with the wrong account. That was me. đ)
Overview
Description
The current behaviour when creating a new branch off of a remote branch is to always track the branch it was created from.
For example, if a branch 'my_branch' is created off of the remote branch 'fix_crash_13', then 'my_branch' will be tracking the remote 'fix_crash_13' branch. It is common practice to have both the local and remote branches named the same when the local is tracking the remote one. Therefore, it is reasonable to expect that 'my_branch' should not track the remote 'fix_crash_13' branch.
The new behaviour when creating a new branch off of a remote branch is to track the branch it was created from only if the branch names match. If the branch names DO NOT match then the newly created branch will not track the remote branch it was created from.
For example, if a user creates a new branch 'fix_crash_13' off of the remote branch 'fix_crash_13', then the local 'fix_crash_13' branch will track the remote 'fix_crash_13' branch. However, if the user creates a new branch called 'other_branch_name' off of the remote branch 'fix_crash_13', then the local 'other_branch_name' branch will NOT track the remote 'fix_crash_13' branch.
Please check if the PR fulfills these requirements
[x] Cheatsheets are up-to-date (run
go generate ./...
)[x] Code has been formatted (see here)
[x] Tests have been added/updated (see here for the integration test guide)
[ ] Text is internationalised (see here)
[ ] Docs have been updated if necessary
[x] You've read through your own file changes for silly mistakes etc