Re: bug - Inconsistency of git status and branch, ./git/branches and ./git/HEAD
apologies for a typo: all paths written with ./git, meant to be .git
On Sat, Sep 30, 2023 at 8:51 AM Irina Gulina <igulina@redhat.com> wrote:
Show 49 quoted lines
>
> 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)
> 1. create an empty directory in CLI: mkdir test_repo
> 2. convert it to a git directory: cd test_repo & git init
> 3. 'git status' will say you are "On branch master"
> 4. 'git branch', 'git branch --all', or 'git branch --list' - nothing
> will say the master branch exists. And per man pages definition the
> branch command displays existing branches. So the question is why 'git
> status' says "On branch master", but 'git branches' don't?
> 5. check on 'ls -la ./git/branches' - it's empty
> 6. check on 'ls -la ./git/refs/heads' - it's empty
> 7. check on 'cat ./git/HEAD' - it shows 'ref: refs/heads/master' -
> why? if we didn't create any commit, and no branch exists?
>
> What did you expect to happen? (Expected behavior)
> git status should not say "On branch master", cat ./git/HEAD should be
> empty. Or the master branch should be created in ./git/branches and
> the 'git branch' command should display it.
>
> What happened instead? (Actual behavior)
> Inconsistency between 'git status', 'git branch', ./git/branches and ./git/HEAD
>
> What's different between what you expected and what actually happened?
>
> 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.41.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 6.4.12-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 23
> 17:46:49 UTC 2023 x86_64
> compiler info: gnuc: 13.1
> libc info: glibc: 2.37
> $SHELL (typically, interactive shell): /bin/bash
>
>
> [Enabled Hooks]