gitlab icon indicating copy to clipboard operation
gitlab copied to clipboard

when trying to get a branch by the commit hash it returns 404

Open cdub50 opened this issue 11 years ago • 10 comments

@g.projects.each do |p| 
  @id = p.id if p.name.match(/\test\b/)
end
commit = 'ab02cb87eea9887c68d6421448a76a7dcf123456'
puts @g.commit(@id, commit)

Gitlab::Error::Parsing: The response is not a valid JSON /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:32:in rescue in decode' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:29:indecode' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:16:in parse' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:10:inblock in class:Request' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/httparty-0.13.3/lib/httparty/request.rb:309:in call' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/httparty-0.13.3/lib/httparty/request.rb:309:inparse_response' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/httparty-0.13.3/lib/httparty/request.rb:279:in block in handle_response' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/httparty-0.13.3/lib/httparty/response.rb:23:incall' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/httparty-0.13.3/lib/httparty/response.rb:23:in parsed_response' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:109:inerror_message' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:67:in validate' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/request.rb:39:inget' /Users/cdub/.rvm/gems/ruby-2.1.5@qa/gems/gitlab-3.3.0/lib/gitlab/client/repositories.rb:61:in `commit'

cdub50 avatar May 13 '15 20:05 cdub50

I think the problem might be your regex. I'm guessing you mean to match test<word_boundary> but the \t would match a tab.

asedge avatar May 14 '15 00:05 asedge

even if I put in the id and the hash it still bombs out

On Wed, May 13, 2015 at 5:20 PM, Sean Edge [email protected] wrote:

I think the problem might be your regex. I'm guessing you mean to match test<word_boundary> but the \t would match a tab.

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/gitlab/issues/131#issuecomment-101862829.

cdub50 avatar May 14 '15 00:05 cdub50

Try this: @g.commits(<id>).map(&:id).grep('ab02cb87eea9887c68d6421448a76a7dcf123456'). Make sure you replace <id> with the id of the project you are searching. What do you get back?

asedge avatar May 14 '15 01:05 asedge

Seems like that worked does commit just not work? I am trying to get the branch from the commit. On May 13, 2015 6:01 PM, "Sean Edge" [email protected] wrote:

Try this: @g.commits().map(&:id).grep('ab02cb87eea9887c68d6421448a76a7dcf123456'). Make sure you replace with the id of the project you are searching. What do you get back?

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/gitlab/issues/131#issuecomment-101869801.

cdub50 avatar May 14 '15 01:05 cdub50

I only get back the sha hash with the example. On May 13, 2015 6:12 PM, "Chris Wardall" [email protected] wrote:

Seems like that worked does commit just not work? I am trying to get the branch from the commit. On May 13, 2015 6:01 PM, "Sean Edge" [email protected] wrote:

Try this: @g.commits().map(&:id).grep('ab02cb87eea9887c68d6421448a76a7dcf123456'). Make sure you replace with the id of the project you are searching. What do you get back?

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/gitlab/issues/131#issuecomment-101869801.

cdub50 avatar May 14 '15 01:05 cdub50

The commit method works fine for me.

2.1.2 :013 > Gitlab.commit(3,'b8472c8d728badf4b12cb8b59570fa3c54a03bab').message
 => "first commit\n"

What version of Gitlab are you running?

asedge avatar May 14 '15 01:05 asedge

6.0.0.rc1 On May 13, 2015 6:21 PM, "Sean Edge" [email protected] wrote:

The commit method works fine for me.

2.1.2 :013 > Gitlab.commit(3,'b8472c8d728badf4b12cb8b59570fa3c54a03bab').message => "first commit\n"

What version of Gitlab are you running?

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/gitlab/issues/131#issuecomment-101874475.

cdub50 avatar May 14 '15 01:05 cdub50

I think you may need to update Gitlab. It looks like the route doesn't exist for getting a single commit in the 6.0.0 release. https://github.com/gitlabhq/gitlabhq/blob/6-0-stable/lib/api/repositories.rb

asedge avatar May 15 '15 00:05 asedge

Thanks will let our ops team know that we need to update to gain that functionality. On May 14, 2015 5:18 PM, "Sean Edge" [email protected] wrote:

I think you may need to update Gitlab. It looks like the route doesn't exist for getting a single commit in the 6.0.0 release. https://github.com/gitlabhq/gitlabhq/blob/6-0-stable/lib/api/repositories.rb

— Reply to this email directly or view it on GitHub https://github.com/NARKOZ/gitlab/issues/131#issuecomment-102207499.

cdub50 avatar May 15 '15 01:05 cdub50

Sure, no problem. I'm going to close this issue for now.

asedge avatar May 16 '15 14:05 asedge