Re: [PATCH v2] checkout: print something when checking out paths
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 28, 2019, 21:58 UTC
- Message-ID
- <xmqqimy8a1gx.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20181113182800.26984-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 33 quoted lines
> One of the problems with "git checkout" is that it does so many > different things and could confuse people specially when we fail to > handle ambiguation correctly. > > One way to help with that is tell the user what sort of operation is > actually carried out. When switching branches, we always print > something unless --quiet, either > > - "HEAD is now at ..." > - "Reset branch ..." > - "Already on ..." > - "Switched to and reset ..." > - "Switched to a new branch ..." > - "Switched to branch ..." > > Checking out paths however is silent. Print something so that if we > got the user intention wrong, they won't waste too much time to find > that out. For the remaining cases of checkout we now print either > > - "Checked out ... paths out of the index" > - "Checked out ... paths out of <abbrev hash>" > > Since the purpose of printing this is to help disambiguate. Only do it > when "--" is missing. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > v2 updates the messages a bit but it does not check isatty or add > --count-paths, for consistency reason with how messages are printed > in the branch switching case. > > Consistency is not always a good reason to follow. But I haven't > seen a strong reason to go against it.
One small bug I saw since this was merged is that the message that is given when unmerging, i.e.
git merge other-branch ;# conflicts git checkout --m <path>
is misleading. It gives the same "checked out ... out of the index", but it should be made a lot more distinct, perhaps "unmerged N paths".