Skip to content

First remote branch "HEAD -> origin/master" is a special case and fails gcommit.sha #474

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

Closed
hatkyinc2 opened this issue Jul 25, 2020 · 1 comment · Fixed by #640
Closed

Comments

@hatkyinc2
Copy link
Contributor

hatkyinc2 commented Jul 25, 2020

Subject of the issue

First remote branch HEAD -> origin/master is a special case and fails gcommit.sha
So something like this fails on first iteration

g.branches.remote.each do |branch|
  branch.gcommit.sha
end

Your environment

  • git version 2.17.1
  • ruby-git - git (1.7.0)
  • ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

Steps to reproduce

require 'git'

g = Git.clone("https://github.com/ruby-git/ruby-git","/tmp/github.com/ruby-git/ruby-git")
g.branches.remote.first.gcommit.sha

Expected behaviour

Return the sha of the commit from branch master

Actual behaviour

Git::GitExecuteError (git '--git-dir=/tmp/github.com/ruby-git/ruby-git/.git' '--work-tree=/tmp/github.com/ruby-git/ruby-git' '-c' 'color.ui=false' rev-parse 'remotes/origin/HEAD -> origin/master'  2>&1:fatal: ambiguous argument 'remotes/origin/HEAD -> origin/master': unknown revision or path not in the working tree.)
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
remotes/origin/HEAD -> origin/master
@stale
Copy link

stale bot commented Oct 4, 2020

A friendly reminder that this issue had no activity for 60 days.

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

Successfully merging a pull request may close this issue.

2 participants