Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal: Not a valid object name master #102

Open
medamin25 opened this issue Aug 18, 2022 · 4 comments
Open

fatal: Not a valid object name master #102

medamin25 opened this issue Aug 18, 2022 · 4 comments

Comments

@medamin25
Copy link

hi, iget this error while running git fame perhaps my branch is main .
a workaround that is to use --branch arg like git fame --branch main .

  • I think it 's better to detect the active git branch by default.

running:

$ sh -xc "uname -a ; git fame --version ; git fame " |& sed -ure 's/^(\+\s+)/\n\1/;$s/$/\n/'

output:


+ uname -a
Linux f6c2c582ccf8 5.15.0-1016-gcp #21~20.04.1-Ubuntu SMP Fri Aug 5 12:53:07 UTC 2022 x86_64 GNU/Linux

+ git fame --version
git-fame 2.5.2 (c) 2012-2022 Linus Oleander

+ git fame
Error: Could not run 'git --git-dir='/home/runner/leafserver/.git' --work-tree='/home/runner/leafserver' ls-tree -r master --name-only' => fatal: Not a valid object name master.
Try --help for help.

workaround

$ git fame --branch main
@medamin25
Copy link
Author

medamin25 commented Aug 18, 2022

like #84 by @kannanbalu but it 💯 work with --branch=any_existant_git_branch (or --branch any_existant_git_branch)

$ git fame --branch main

running:

$ sh -xc "uname -a ; git fame --version ; git fame ; git checkout -b development ; git checkout -b mmm ; git branch ; git fame --branch=main >/dev/null ; git fame --branch=mmm >/dev/null ; git fame --branch=development >/dev/null ; git checkout -b master ; git fame >/dev/null ; git fame --branch=master >/dev/null" |& sed -ure 's/^(\+\s+)/\n\1/;$s/$/\n/'

output:


+ uname -a
Linux f6c2c582ccf8 5.15.0-1016-gcp #21~20.04.1-Ubuntu SMP Fri Aug 5 12:53:07 UTC 2022 x86_64 GNU/Linux

+ git fame --version
git-fame 2.5.2 (c) 2012-2022 Linus Oleander

+ git fame
Error: Could not run 'git --git-dir='/home/runner/leafserver/.git' --work-tree='/home/runner/leafserver' ls-tree -r master --name-only' => fatal: Not a valid object name master.
Try --help for help.

+ git checkout -b development
Switched to a new branch 'development'

+ git checkout -b mmm
Switched to a new branch 'mmm'

+ git branch
  development
  main
* mmm

+ git fame --branch=main
Git Fame:      100% |oooooooooooooooooooooooooooooooo| Time:   0:00:00

+ git fame --branch=mmm
Git Fame:      100% |oooooooooooooooooooooooooooooooo| Time:   0:00:00

+ git fame --branch=development
Git Fame:      100% |oooooooooooooooooooooooooooooooo| Time:   0:00:01

+ git checkout -b master
Switched to a new branch 'master'

+ git fame
Git Fame:      100% |oooooooooooooooooooooooooooooooo| Time:   0:00:00

+ git fame --branch=master
Git Fame:      100% |oooooooooooooooooooooooooooooooo| Time:   0:00:00

@medamin25
Copy link
Author

me also like @MrShoenel in this comment:

When I run git ls-tree -r HEAD --name-only on my own, I get a list of all tracked files, so it's not Git that fails.
And yes, C:/repos/my-repo and C:/repos/my-repo/.git exist. It is a valid repository. I guess I am getting some concealed error here..

both commands git ls-tree --name-only HEAD ; git ls-tree -r HEAD --name-only work for me.

@medamin25
Copy link
Author

medamin25 commented Aug 18, 2022

Also i remark, that git-fame and when branch master exist, always work on branch master even if current branch not master.

  • so, i think that branch master is hard coded somewhere in code.
    I found that --branch option not hard coded and has a default value of HEAD. So why? 😮

@oleander
Copy link
Owner

There might be some reference to master somewhere within the code base, but I agree that it should use the current branch rather than master.

I'm open for a PR ツ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants