{"thread":{"id":"60751","subject":"git-bugreport-2024-01-16-2051","startedAt":"2024-01-16T15:30:52Z","lastAt":"2024-01-16T19:10:40Z","messageCount":2,"participants":["Vaibhav Naik","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"486844","messageId":"CALZECO2kHf_qPX06kOUPbJT_hNd5Txt9FTh_Pxr+9x_sMJdKOg@mail.gmail.com","threadId":"60751","inReplyTo":null,"subject":"git-bugreport-2024-01-16-2051","fromName":"Vaibhav Naik","fromEmail":"vaibhavnaik2004@gmail.com","sentAt":"2024-01-16T15:30:12Z","receivedAt":"2024-01-16T15:30:52Z","isPatch":false,"sender":{"key":"vaibhavnaik2004@gmail.com","avatar":null},"body":"\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\ni typed this command in order:\ngit checkout ca35d53\ngit tag 1.1.2\ngit commit --allow-empty -m \"want to commit at any cost\"\n(i just wanted to commit to catch the bug)\n\nWhat did you expect to happen? (Expected behavior)\nwhen I checkout, it was showing the commit id at the place of HEAD Point:\nvaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((ca35d53...))\nand then after creating a new tag it was showing the tag name at the place of HEAD Point:\nvaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))\nwhich is wrong, that place is to show where the HEAD is pointing at and not the newly created tag name\n\nWhat happened instead? (Actual behavior)\nIt showed the newly created tag name at the place of the HEAD Point:\nvaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))\n\nWhat's different between what you expected and what actually happened?\nIt should show the the detached HEAD commit id at the place of HEAD Point and not the newly created tag name\nI proved this wrong by doing a commit which didn't got committed to any branch or tag but it moved the HEAD:\n\nvaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((newt))\n$ git commit --allow-empty -m \"want to commit at any cost\"\n[detached HEAD caad8ef] want to commit at any cost\n\nvaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((caad8ef...))\n$ git status\nHEAD detached from ca35d53\nnothing to commit, working tree clean\n\nit showed the tag name in the brackets\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.43.0.windows.1\ncpu: x86_64\nbuilt from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 22631 \ncompiler info: gnuc: 13.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n"},{"id":"486859","messageId":"2914293d-7128-435c-9e02-0531954cab26@web.de","threadId":"60751","inReplyTo":"CALZECO2kHf_qPX06kOUPbJT_hNd5Txt9FTh_Pxr+9x_sMJdKOg@mail.gmail.com","subject":"Re: git-bugreport-2024-01-16-2051","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2024-01-16T19:10:37Z","receivedAt":"2024-01-16T19:10:40Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 16.01.24 um 16:30 schrieb Vaibhav Naik:\n>\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n>\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> i typed this command in order:\n> git checkout ca35d53\n> git tag 1.1.2\n> git commit --allow-empty -m \"want to commit at any cost\"\n> (i just wanted to commit to catch the bug)\n>\n> What did you expect to happen? (Expected behavior)\n> when I checkout, it was showing the commit id at the place of HEAD Point:\n> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((ca35d53...))\n> and then after creating a new tag it was showing the tag name at the place of HEAD Point:\n> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))\n> which is wrong, that place is to show where the HEAD is pointing at and not the newly created tag name\n\nThe \"it\" in \"it was showing the tag name\" is your prompt, right?  It\nlooks like the one provided by contrib/completion/git-prompt.sh.  A\nversion of that script is at [1].  It is quite long and configurable,\nbut it shows the output of \"git describe --tags --exact-match HEAD\" if\nthe HEAD commit is tagged or otherwise its abbreviated hash.\n\nWhich matches what you see: both your (detached) HEAD and your tag\npoint to commit ca35d53, so the tag name is shown.  The idea being\nthat a symbolic name is more meaningful to a reader than a hash value.\nYou just gave that commit a name, so the prompt script uses it.\n\n> What happened instead? (Actual behavior)\n> It showed the newly created tag name at the place of the HEAD Point:\n> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2))\n>\n> What's different between what you expected and what actually happened?\n> It should show the the detached HEAD commit id at the place of HEAD Point and not the newly created tag name\n> I proved this wrong by doing a commit which didn't got committed to any branch or tag but it moved the HEAD:\n>\n> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((newt))\n> $ git commit --allow-empty -m \"want to commit at any cost\"\n> [detached HEAD caad8ef] want to commit at any cost\n>\n> vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((caad8ef...))\n> $ git status\n> HEAD detached from ca35d53\n> nothing to commit, working tree clean\n>\n> it showed the tag name in the brackets\n\ngit commit moves the HEAD, even if it is detached, true.  And you\ncreated an untagged commit, so the prompt fell back to showing its\nabbreviated hash.  I don't see how this proves that showing the tag name\nfor a tagged commit is somehow wrong.  What would be the benefit?\n\nI can understand that prompts are a matter of personal preference,\nthough.  You can adjust what the prompt shows by setting the environment\nvariable GIT_PS1_DESCRIBE_STYLE.  See git-prompt.sh lines 91 ff. for a\ndescription of the recognized values (or check your local version of the\nscript).  There's no option to ignore tags and always show the\nabbreviated hash, though, yet.\n\nTo summarize: I don't think the behavior you saw indicates a bug, and\nthe prompt style you'd like to use doesn't seem to be implemented, yet.\nIt shouldn't be difficult to add, but I don't quite get why you'd want\nto shun tags.\n\n>\n> Anything else you want to add:\n>\n> Please review the rest of the bug report below.\n> You can delete any lines you don't wish to share.\n>\n>\n> [System Info]\n> git version:\n> git version 2.43.0.windows.1\n> cpu: x86_64\n> built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297\n> sizeof-long: 4\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> feature: fsmonitor--daemon\n> uname: Windows 10.0 22631\n> compiler info: gnuc: 13.2\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n>\n>\n> [Enabled Hooks]\n\n"}]}