Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels