trunk.cocoapods.org icon indicating copy to clipboard operation
trunk.cocoapods.org copied to clipboard

Data can be pushed to GitHub without creating a Commit record.

Open alloy opened this issue 10 years ago • 3 comments

There’s a bug that makes it that a POST to github actually succeeds, but no Commit record is ever created. Looking at PodVersion#push! it would seem that the this might occur because response.success? is returning false when it actually did succeeded.

Because the user thinks the push failed, they might try again and run into an issue with the UPDATE variant of GitHub’s contents API (opposed to CREATE) requiring a SHA. This returns a 422 to us and we return a 500 to the user.

An example, which I have since fixed manually:

irb(main):001:0> Pod::TrunkApp::Pod.find(:name => 'DB5-Live')
I, [2014-05-23T21:25:24.179119 #2]  INFO -- : (0.004418s) SELECT * FROM "pods" WHERE ("name" = 'DB5-Live') LIMIT 1
=> #<Pod::TrunkApp::Pod @values={:id=>5066, :name=>"DB5-Live", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil}>
irb(main):002:0> p = _
=> #<Pod::TrunkApp::Pod @values={:id=>5066, :name=>"DB5-Live", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil}>
irb(main):003:0> p.versions
I, [2014-05-23T21:25:30.309944 #2]  INFO -- : (0.003187s) SELECT * FROM "pod_versions" WHERE ("pod_versions"."pod_id" = 5066)
=> [#<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>]
irb(main):004:0> p.versions.first
=> #<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>
irb(main):005:0> v = _
=> #<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>
irb(main):006:0> v.commits
I, [2014-05-23T21:26:33.659066 #2]  INFO -- : (0.002274s) SELECT * FROM "commits" WHERE ("commits"."pod_version_id" = 15510) ORDER BY ("updated_at", "created_at") ASC
=> []

alloy avatar May 23 '14 21:05 alloy