Re: [PATCH RESEND 2/2] status: improve info for detached HEAD after clone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

First of all, thanks for the thoughtful response.

Junio C Hamano <gitster@xxxxxxxxx> writes:

> - Adding new code here would mean that the result of parsing @{-1}
>   and what wt_status_get_detached_from() will report becomes
>   inconsistent, no?

If I understand correctly, the result of parsing @{-1} is the commit
checked out before the current one, so grab_nth_branch_switch() gets
the commit we've moved _from_, whereas wt-status::grab_1st_switch()
gets the commit we've moved _to_. After a clone, there is no commit
we've moved _from_.

> Yes, the head may be detached at some object that is not a local or
> remote branch.  But what is so bad about reporting the fact
> faithfully, i.e., that we are not on any branch?

I thought that we try to avoid showing "Not currently on any branch"
as this message is not very user-friendly (see commit b397ea4).
Furthermore, showing "HEAD detached at X" where X is the abbreviated
hash is more consistent with the behavior of the detached HEAD advice
in "git clone", which says

        Note: switching to 'X'

> I personally do not very much appreciate the extra info that is
> given by saying "HEAD detached at X" and "HEAD detached from X",
> compared to saying just "Not currently on any branch", especially
> when these X are not concrete branch names or tag names but just
> hexadecimal string that needs to be fed to "git describe" to be
> turned into something that makes sense to humans

It might be better to show "HEAD detached at X" where X is the concrete
tag name which was cloned; but since "grab_1st_switch" digs in the
reflog for that information, one cannot figure out the tag name that
was used when the repository was cloned. I didn't want to complicate
the current logic too much, and IMHO showing the abbreviated hash is
the best thing we can do, and it is already what we do in certain cases
(e.g. after "git checkout --detach").



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux