git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-bugreport-2024-01-16-2051
@ 2024-01-16 15:30 Vaibhav Naik
  2024-01-16 19:10 ` git-bugreport-2024-01-16-2051 René Scharfe
  0 siblings, 1 reply; 2+ messages in thread
From: Vaibhav Naik @ 2024-01-16 15:30 UTC (permalink / raw)
  To: git


[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 47 bytes --]

[-- Attachment #2: git-bugreport-2024-01-16-2051.txt --]
[-- Type: text/plain, Size: 2179 bytes --]

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)
i typed this command in order:
git checkout ca35d53
git tag 1.1.2
git commit --allow-empty -m "want to commit at any cost"
(i just wanted to commit to catch the bug)

What did you expect to happen? (Expected behavior)
when I checkout, it was showing the commit id at the place of HEAD Point:
vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((ca35d53...))
and then after creating a new tag it was showing the tag name at the place of HEAD Point:
vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))
which is wrong, that place is to show where the HEAD is pointing at and not the newly created tag name

What happened instead? (Actual behavior)
It showed the newly created tag name at the place of the HEAD Point:
vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))

What's different between what you expected and what actually happened?
It should show the the detached HEAD commit id at the place of HEAD Point and not the newly created tag name
I proved this wrong by doing a commit which didn't got committed to any branch or tag but it moved the HEAD:

vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((newt))
$ git commit --allow-empty -m "want to commit at any cost"
[detached HEAD caad8ef] want to commit at any cost

vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((caad8ef...))
$ git status
HEAD detached from ca35d53
nothing to commit, working tree clean

it showed the tag name in the brackets

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.43.0.windows.1
cpu: x86_64
built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 22631 
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe


[Enabled Hooks]

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

* Re: git-bugreport-2024-01-16-2051
  2024-01-16 15:30 git-bugreport-2024-01-16-2051 Vaibhav Naik
@ 2024-01-16 19:10 ` René Scharfe
  0 siblings, 0 replies; 2+ messages in thread
From: René Scharfe @ 2024-01-16 19:10 UTC (permalink / raw)
  To: Vaibhav Naik, git

Am 16.01.24 um 16:30 schrieb Vaibhav Naik:
>
> 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)
> i typed this command in order:
> git checkout ca35d53
> git tag 1.1.2
> git commit --allow-empty -m "want to commit at any cost"
> (i just wanted to commit to catch the bug)
>
> What did you expect to happen? (Expected behavior)
> when I checkout, it was showing the commit id at the place of HEAD Point:
> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((ca35d53...))
> and then after creating a new tag it was showing the tag name at the place of HEAD Point:
> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))
> which is wrong, that place is to show where the HEAD is pointing at and not the newly created tag name

The "it" in "it was showing the tag name" is your prompt, right?  It
looks like the one provided by contrib/completion/git-prompt.sh.  A
version of that script is at [1].  It is quite long and configurable,
but it shows the output of "git describe --tags --exact-match HEAD" if
the HEAD commit is tagged or otherwise its abbreviated hash.

Which matches what you see: both your (detached) HEAD and your tag
point to commit ca35d53, so the tag name is shown.  The idea being
that a symbolic name is more meaningful to a reader than a hash value.
You just gave that commit a name, so the prompt script uses it.

> What happened instead? (Actual behavior)
> It showed the newly created tag name at the place of the HEAD Point:
> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))
>
> What's different between what you expected and what actually happened?
> It should show the the detached HEAD commit id at the place of HEAD Point and not the newly created tag name
> I proved this wrong by doing a commit which didn't got committed to any branch or tag but it moved the HEAD:
>
> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((newt))
> $ git commit --allow-empty -m "want to commit at any cost"
> [detached HEAD caad8ef] want to commit at any cost
>
> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((caad8ef...))
> $ git status
> HEAD detached from ca35d53
> nothing to commit, working tree clean
>
> it showed the tag name in the brackets

git commit moves the HEAD, even if it is detached, true.  And you
created an untagged commit, so the prompt fell back to showing its
abbreviated hash.  I don't see how this proves that showing the tag name
for a tagged commit is somehow wrong.  What would be the benefit?

I can understand that prompts are a matter of personal preference,
though.  You can adjust what the prompt shows by setting the environment
variable GIT_PS1_DESCRIBE_STYLE.  See git-prompt.sh lines 91 ff. for a
description of the recognized values (or check your local version of the
script).  There's no option to ignore tags and always show the
abbreviated hash, though, yet.

To summarize: I don't think the behavior you saw indicates a bug, and
the prompt style you'd like to use doesn't seem to be implemented, yet.
It shouldn't be difficult to add, but I don't quite get why you'd want
to shun tags.

>
> Anything else you want to add:
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.43.0.windows.1
> cpu: x86_64
> built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 22631
> compiler info: gnuc: 13.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
>
>
> [Enabled Hooks]


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

end of thread, other threads:[~2024-01-16 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16 15:30 git-bugreport-2024-01-16-2051 Vaibhav Naik
2024-01-16 19:10 ` git-bugreport-2024-01-16-2051 René Scharfe

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).