Re: [PATCH v3 18/21] switch: no worktree status unless real branch switch happens
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 10, 2019, 03:43 UTC
- Message-ID
- <CAPig+cTR8px1MCq0qXijt1x2+BAgpsKCiRR1hw3hHiVc2NkHAA@mail.gmail.com>
- In-Reply-To
- <20190308095752.8574-19-pclouds@gmail.com>
On Fri, Mar 8, 2019 at 4:59 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 13 quoted lines
> When we switch from one branch to another, it makes sense to show a > summary of local changes since there could be conflicts, or some files > left modified.... When switch is used solely for creating a new > branch (and "switch" to the same commit) or detaching, we don't really > need to show anything. > > "git checkout" does it anyway for historical reasons. But we can start > with a clean slate with switch and don't have to. > > This essentially reverts fa655d8411 (checkout: optimize "git checkout > -b <new_branch>" - 2018-08-16) and make it default for switch, > but also for -B and --detach. Users of big repos are encouraged to > move to switch.
I like this last bit. The skip_merge_working_tree() function which this removes was ugly, difficult to maintain, and difficult to get just right (and easy to break -- even by changing parts of the system which one might not expect to impact it).