All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matt Thompson <fortran@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Bug: Git sees branch as valid commit ref and works; should fail
Date: Mon, 05 Aug 2024 09:35:00 -0700	[thread overview]
Message-ID: <xmqqy15b2aiz.fsf@gitster.g> (raw)
In-Reply-To: <CAFb48S8LDz4kiWsKSCBn8J=AHyQ5SVPFH4GY=z+8=DntT=PyAw@mail.gmail.com> (Matt Thompson's message of "Mon, 5 Aug 2024 11:07:41 -0400")

Matt Thompson <fortran@gmail.com> writes:

> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> $ git clone https://github.com/GEOS-ESM/GFDL_atmos_cubed_sphere.git fvdycore
> $ cd fvdycore
> $ git checkout bugfix/mathomp4/trivial-ci-commit-gcc14
>
> What did you expect to happen? (Expected behavior)
>
> I expected a failure as there is no branch named
> 'bugfix/mathomp4/trivial-ci-commit-gcc14' in the repository.

If you run

  $ git for-each-ref | grep /bugfix/mathomp4/trivial-ci-commit-gcc14

I suspect you have a remote-tracking branch that matches the
pattern.  In such a case, "bugfix/mathomp4/trivial-ci-commit-gcc14"
is a very valid way to refer to a commit to any Git command.  It is
handy to say "git show bugfix/mathomp4/trivial-ci-commit-gcc14", for
example.

And when "git checkout" is given a commit that is not a local
branch, what it did below (by the way, thanks for giving a very
accurate "Actual behavior" description in your report) is very much
expected behaviour, including the part that it gave a message to
advise how to work on a detached HEAD.

> What happened instead? (Actual behavior)
>
> $ git checkout bugfix/mathomp4/trivial-ci-commit-gcc14
> Note: switching to 'bugfix/mathomp4/trivial-ci-commit-gcc14'.
> ...


  reply	other threads:[~2024-08-05 16:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 15:07 Bug: Git sees branch as valid commit ref and works; should fail Matt Thompson
2024-08-05 16:35 ` Junio C Hamano [this message]
2024-08-05 16:58   ` Matt Thompson
2024-08-13 11:53     ` Jeff King
2024-08-13 12:45       ` [PATCH] get_oid(): enforce minimum length for "-g<hex>" names Jeff King
2024-08-13 13:02         ` Jeff King
2024-08-13 15:41       ` Bug: Git sees branch as valid commit ref and works; should fail Junio C Hamano

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=xmqqy15b2aiz.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=fortran@gmail.com \
    --cc=git@vger.kernel.org \
    /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.