git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roy Eldar <royeldar0@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, jonathantanmy@google.com,
	Roy Eldar <royeldar0@gmail.com>
Subject: [PATCH RESEND 0/2] status: improve info for detached HEAD
Date: Wed,  8 Mar 2023 21:20:48 +0200	[thread overview]
Message-ID: <20230308192050.1291-1-royeldar0@gmail.com> (raw)

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


             reply	other threads:[~2023-03-08 19:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 19:20 Roy Eldar [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230308192050.1291-1-royeldar0@gmail.com \
    --to=royeldar0@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).