git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/2] status: improve info for detached HEAD
@ 2023-03-08 19:20 Roy Eldar
  2023-03-08 19:20 ` [PATCH RESEND 1/2] t7508: test status output for detached HEAD after clone Roy Eldar
  2023-03-08 19:20 ` [PATCH RESEND 2/2] status: improve info " Roy Eldar
  0 siblings, 2 replies; 5+ messages in thread
From: Roy Eldar @ 2023-03-08 19:20 UTC (permalink / raw)
  To: git; +Cc: gitster, jonathantanmy, Roy Eldar

When a repository is cloned using "git clone -b" and a tag is specified,
HEAD is automatically detached. As a result, "git status" shows
"currently not on any branch", which is not very useful.

Teach "git status" to generate the "HEAD detached at" message in this
case as well, in a similar way to when a tag is checked out.

In the case of "git checkout", the name of the ref that was checked out
is retrieved from the reflog; for "git clone", the name of the ref isn't
present in the reflog entry, so we use the abbreviated hash instead.
This is also consistent with the "detached HEAD" advice.

Roy Eldar (2):
  t7508: test status output for detached HEAD after clone
  status: improve info for detached HEAD after clone

 t/t7508-status.sh | 12 ++++++++++++
 wt-status.c       |  7 +++++++
 2 files changed, 19 insertions(+)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-10 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08 19:20 [PATCH RESEND 0/2] status: improve info for detached HEAD Roy Eldar
2023-03-08 19:20 ` [PATCH RESEND 1/2] t7508: test status output for detached HEAD after clone Roy Eldar
2023-03-08 19:20 ` [PATCH RESEND 2/2] status: improve info " Roy Eldar
2023-03-08 20:42   ` Junio C Hamano
2023-03-10 16:25     ` Roy E

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).