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 1/2] t7508: test status output for detached HEAD after clone
Date: Wed, 8 Mar 2023 21:20:49 +0200 [thread overview]
Message-ID: <20230308192050.1291-2-royeldar0@gmail.com> (raw)
In-Reply-To: <20230308192050.1291-1-royeldar0@gmail.com>
After cloning a repository, HEAD might be detached: for example, when
"--branch" specifies a non-branch (e.g. a tag). In this case, running
"git status" prints 'Not currently on any branch'.
Signed-off-by: Roy Eldar <royeldar0@gmail.com>
---
t/t7508-status.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index aed07c5b62..d279157d28 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -885,6 +885,18 @@ test_expect_success 'status shows detached HEAD properly after checking out non-
grep -E "HEAD detached at [0-9a-f]+" actual
'
+test_expect_success 'status shows detached HEAD properly after cloning a repository' '
+ test_when_finished rm -rf upstream downstream actual &&
+
+ git init upstream &&
+ test_commit -C upstream foo &&
+ git -C upstream tag test_tag &&
+
+ git clone -b test_tag upstream downstream &&
+ git -C downstream status >actual &&
+ grep -E "Not currently on any branch." actual
+'
+
test_expect_success 'setup status submodule summary' '
test_create_repo sm && (
cd sm &&
--
2.30.2
next prev parent 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 [PATCH RESEND 0/2] status: improve info for detached HEAD Roy Eldar
2023-03-08 19:20 ` Roy Eldar [this message]
2023-03-08 19:20 ` [PATCH RESEND 2/2] status: improve info for detached HEAD after clone 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-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.