vitorgalvao / tiny-scripts

Collection of small scripts
The Unlicense
309 stars 53 forks source link

cask-repair Unprocessable Entity (HTTP 422) #20

Closed yurikoles closed 8 years ago

yurikoles commented 8 years ago

every time when I accept submit

Submitting…
Error creating pull request: Unprocessable Entity (HTTP 422)
Missing field: "head_sha"
Missing field: "base_sha"
No commits between master and cask-repair_update-torbrowser-de
Error creating pull request: Unprocessable Entity (HTTP 422)
Missing field: "head_sha"
Missing field: "base_sha"
No commits between master and cask-repair_update-torbrowser-de

full output: https://gist.github.com/yurikoles/9e527b651f3b7c0961e4761d7b3abad0

vitorgalvao commented 8 years ago

Do this and this, and report back.

OmgImAlexis commented 8 years ago

I've got the a similar issue.

To git@github.com:OmgImAlexis/homebrew-cask.git
 ! [remote rejected] cask-repair_update-radio-silence -> cask-repair_update-radio-silence (shallow update not allowed)
error: failed to push some refs to 'git@github.com:OmgImAlexis/homebrew-cask.git'
Error creating pull request: Unprocessable Entity (HTTP 422)
Missing field: "head_sha"
Missing field: "base_sha"
No commits between master and cask-repair_update-radio-silence
Error creating pull request: Unprocessable Entity (HTTP 422)
Missing field: "head_sha"
Missing field: "base_sha"
No commits between master and cask-repair_update-radio-silence

There was an error submitting the pull request. Have you forked the repo and made sure the pull and push remotes exist?
vitorgalvao commented 8 years ago

@OmgImAlexis Then please run the requested commands. I keep asking an no one does it. Until someone does, I won’t be able to debug this.

vitorgalvao commented 8 years ago

Closing. Won’t tackle the issue until someone runs the requested commands.

yurikoles commented 8 years ago

Please reopen

$ brew info cask-repair hub | grep -E '(cask-repair:|hub:)'?
vitorgalvao/tiny-scripts/cask-repair: stable 0.23.1
hub: stable 2.2.3 (bottled), HEAD

What’s the exact cask-repair command you ran?

cask-repair -l origin -p yurikoles epic-game-launcher

In which directory are you? Are you right on the tap, or another directory?

/usr/local/Library/Taps/caskroom/homebrew-cask/Casks

What are the outputs of:

git diff --shortstat
git status --porcelain

no output

vitorgalvao commented 8 years ago

@yurikoles Thank you. Can you still reproduce the issue?

My question being: “if you run the same command twice in a row, does it fail twice, or just the first time?”.

yurikoles commented 8 years ago

@vitorgalvao yes, its always reproducible.

vitorgalvao commented 8 years ago

Do git reset HEAD --hard && git clean -d --force and then try again. Does the error still happen?

howie commented 8 years ago

yes, after git reset HEAD --hard && git clean -d --force still error.

hoangkn commented 8 years ago

I have had a similar error. Have you setup SSH key on your computer and GitHub? https://help.github.com/articles/generating-an-ssh-key/

vitorgalvao commented 8 years ago

Need a git remote -v from all of you.

yurikoles commented 8 years ago
origin  https://github.com/caskroom/homebrew-cask (fetch)
origin  https://github.com/caskroom/homebrew-cask (push)
yurikoles   git@github.com:yurikoles/homebrew-cask.git (fetch)
yurikoles   git@github.com:yurikoles/homebrew-cask.git (push)
howie commented 8 years ago

howie git@github.com:howie/homebrew-cask.git (fetch) howie git@github.com:howie/homebrew-cask.git (push) origin https://github.com/caskroom/homebrew-cask (fetch) origin https://github.com/caskroom/homebrew-cask (push)

vitorgalvao commented 8 years ago

Do

git rebase --abort
git am --abort

and try again. Does that fix it?

joeygravlin commented 8 years ago

I was having the same issue, with git remote -v outputing:

joeygravlin https://github.com/joeygravlin/homebrew-cask (fetch)
joeygravlin https://github.com/joeygravlin/homebrew-cask (push)
origin  https://github.com/caskroom/homebrew-cask (fetch)
origin  https://github.com/caskroom/homebrew-cask (push)

@vitorgalvao's most recent suggestion fixed it for me.

nstCactus commented 8 years ago

I'm having the same issue and nothing seems to be able to fix it.

Here is the output of git remote -v:

nstCactus git@github.com:nstCactus/homebrew-cask-versions.git (fetch) nstCactus git@github.com:nstCactus/homebrew-cask-versions.git (push) origin https://github.com/caskroom/homebrew-versions (fetch) origin https://github.com/caskroom/homebrew-versions (push)

And here is what I did:

  1. Upgrade hub: brew upgrade hub => Error: hub 2.2.3 already installed
  2. Update cask-repair brew upgrade cask-repair => Error: vitorgalvao/tiny-scripts/cask-repair 0.23.2 already installed
  3. Tried the running the script cask-repair --pull origin --push nstCactus airmail-beta => Unprocessable entity
  4. Ran git rebase --abort => No rebase in progress?
  5. Ran git am --abort => fatal: Resolve operation not in progress, we are not resuming.
  6. git branch -D on anything but master
  7. Went to my github fork and deleted any remote branch but master
  8. Tried again: cask-repair --pull origin --push nstCactus airmail-beta => Same output as in first try:

cask 'airmail-beta' do version '2.6.1,364' sha256 '447ce9fe31cdeab0c4e9ce7fb9d7ee6b44b47e3bdaf12b8abf541c4cf21472dd'

hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04 was verified as official when first introduced to the cask

url 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/245?format=zip&' appcast 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04', checkpoint: 'fb401617167497f4161a0aa16d8c7d773d895c3148d5c7ef34195d5924935731' name 'AirMail' homepage 'http://airmailapp.com/beta/' license :commercial

app 'AirMail Beta.app'

end

Type the new version (or leave blank to use the current one)

3.0,366 Paste the new URL (or leave blank to use the current one) https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/246?format=zip ==> Downloading external files for Cask ./airmail-beta.rb ==> Downloading https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e ######################################################################## 100,0% ==> No checksum defined for Cask airmail-beta, skipping verification ==> Success! Downloaded to -> /Library/Caches/Homebrew/airmail-beta-3.0,366 diff --git a/Casks/airmail-beta.rb b/Casks/airmail-beta.rb index 5e80f8f..e639914 100644 --- a/Casks/airmail-beta.rb +++ b/Casks/airmail-beta.rb @@ -1,11 +1,11 @@ cask 'airmail-beta' do

  • version '2.6.1,364'
  • sha256 '447ce9fe31cdeab0c4e9ce7fb9d7ee6b44b47e3bdaf12b8abf541c4cf21472dd'
  • version '3.0,366'
  • sha256 '11d49794b27b11aac027256e402fd3e55830d32bd062343ba67d78f4160dccc6'

hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04 was verified as official when first introduced to the cask

There was an error submitting the pull request. Have you forked the repo and made sure the pull and push remotes exist?

That's as much info as I can gather. Hope this helps!

vitorgalvao commented 8 years ago

Thank you all for the details. It seems like all of you are running this from $(brew --repository)/Library/Taps/caskroom/…, is that correct?

I’d like you to run a few more commands, then. Make sure you’re in the correct directory for running cask-repair and:

git checkout master
git pull rebase origin master
cask-repair --push {{your_push_remote}} --delete-branches
git push {{your_push_remote}} master

This will make sure you’re on master, pull the latest changes, delete any cask-repair-created branches, and make sure your remote is up-to-date with the main repo.

After that, please retry your failing cask-repair commands.

nstCactus commented 8 years ago

Yes it is correct, this is the full path: $(brew --repository)/Library/Taps/caskroom/homebrew-cask.

Here is the results you asked:

git checkout master

Already on 'master' Your branch is up-to-date with 'origin/master'.

git pull && git rebase origin master

remote: Counting objects: 28, done. remote: Compressing objects: 100% (23/23), done. remote: Total 28 (delta 18), reused 13 (delta 5), pack-reused 0 Unpacking objects: 100% (28/28), done. From https://github.com/caskroom/homebrew-cask 773e15b..d71d907 master -> origin/master Updating 773e15b..d71d907 Fast-forward Casks/clipy.rb | 6 +++--- Casks/cycling74-max.rb | 4 ++-- Casks/dwarf-fortress-lnp.rb | 13 +++++++++++++ Casks/knock.rb | 10 ++++++++++ Casks/mongochef.rb | 2 +- Casks/picat.rb | 13 +++++++++++++ Casks/porting-kit.rb | 25 +++++++++++++++++++++++++ 7 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 Casks/dwarf-fortress-lnp.rb create mode 100644 Casks/picat.rb create mode 100644 Casks/porting-kit.rb Current branch master is up to date.

cask-repair --push nstCactus --delete-branches

remote: Counting objects: 225, done. remote: Compressing objects: 100% (170/170), done. remote: Total 225 (delta 191), reused 84 (delta 52), pack-reused 0 Receiving objects: 100% (225/225), 28.51 KiB | 0 bytes/s, done. Resolving deltas: 100% (191/191), completed with 188 local objects. From github.com:nstCactus/homebrew-cask

  • [new branch] airmail-beta -> nstCactus/airmail-beta
  • [new branch] audit-links -> nstCactus/audit-links
  • [new branch] brew-cask-outdated -> nstCactus/brew-cask-outdated
  • [new branch] f-https-sourceforge-urls -> nstCactus/f-https-sourceforge-urls
  • [new branch] f-install-exact-match-searches -> nstCactus/f-install-exact-match-searches
  • [new branch] fix-alfred-preference-install -> nstCactus/fix-alfred-preference-install
  • [new branch] gh-pages -> nstCactus/gh-pages
  • [new branch] info-machine-readable-requires-sudo -> nstCactus/info-machine-readable-requires-sudo
  • a6e2273...e8d23f8 master -> nstCactus/master (forced update)
  • [new branch] mountain-duck -> nstCactus/mountain-duck
  • [new branch] revert-10854-master -> nstCactus/revert-10854-master
git push nstCactus master --force

Counting objects: 11039, done. Delta compression using up to 4 threads. Compressing objects: 100% (4810/4810), done. Writing objects: 100% (11039/11039), 1.78 MiB | 187.00 KiB/s, done. Total 11039 (delta 7916), reused 9231 (delta 6222) To git@github.com:nstCactus/homebrew-cask.git ! [remote rejected] master -> master (shallow update not allowed) error: failed to push some refs to 'git@github.com:nstCactus/homebrew-cask.git'

vitorgalvao commented 8 years ago

@nstCactus I see (in your last command):

! [remote rejected] master -> master (shallow update not allowed)

Does this fix that? And if so, does your cask-repair command keep failing?

nstCactus commented 8 years ago

git fetch --unshallow nstCactus made me able to push to my fork again.

I then ran these commands:

cd "$(brew --repository)/Library/Taps/caskroom/homebrew-versions/Casks"
echo "=> Checking out master"
git checkout master
echo "=> Pulling & rebasing"
git pull && git rebase origin master
echo "=> Deleting remote branches"
cask-repair --push nstCactus --delete-branches
echo "Pushing"
git push nstCactus master --force
echo "Trying to fix the cask"
cask-repair --pull origin --push nstCactus airmail-beta

=> Checking out master Already on 'master' Your branch is up-to-date with 'origin/master'. => Pulling & rebasing Already up-to-date. Current branch master is up to date. => Deleting remote branches Pushing Everything up-to-date Trying to fix the cask

 cask 'airmail-beta' do
   version '2.6.1,364'
   sha256 '447ce9fe31cdeab0c4e9ce7fb9d7ee6b44b47e3bdaf12b8abf541c4cf21472dd'

   # hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04 was verified as official when first introduced to the cask
   url 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/245?format=zip&'
   appcast 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04',
       checkpoint: 'fb401617167497f4161a0aa16d8c7d773d895c3148d5c7ef34195d5924935731'
   name 'AirMail'
   homepage 'http://airmailapp.com/beta/'
   license :commercial

   app 'AirMail Beta.app'
end

Type the new version (or leave blank to use the current one)

3.0,366 Paste the new URL (or leave blank to use the current one) https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/246?format=zip 3 ==> Downloading external files for Cask ./airmail-beta.rb ==> Downloading https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1 ########################################################### 100,0% ==> No checksum defined for Cask airmail-beta, skipping verification ==> Success! Downloaded to -> /Library/Caches/Homebrew/airmail-beta- diff --git a/Casks/airmail-beta.rb b/Casks/airmail-beta.rb index 5e80f8f..fb64e61 100644

--- a/Casks/airmail-beta.rb
+++ b/Casks/airmail-beta.rb
@@ -1,11 +1,11 @@
 cask 'airmail-beta' do
-  version '2.6.1,364'
-  sha256 '447ce9fe31cdeab0c4e9ce7fb9d7ee6b44b47e3bdaf12b8abf541c4cf21472dd'
+  version '3.0,366'
+  sha256 '11d49794b27b11aac027256e402fd3e55830d32bd062343ba67d78f4160dccc6'

   # hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04 was verified as official when first introduced to the cask
-  url 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/245?format=zip&'
+  url 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04/app_versions/246?format=zip&'
   appcast 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04',
-          checkpoint: 'fb401617167497f4161a0aa16d8c7d773d895c3148d5c7ef34195d5924935731'
+          checkpoint: '63071cbc3e38e17842cab7d296e85dda1ed7cd90b3ac152aa70fc0a125124096'
   name 'AirMail'
   homepage 'http://airmailapp.com/beta/'
   license :commercial

Is everything correct? You can also make further manual edits (y/n/e) y Submitting… Error creating pull request: Unprocessable Entity (HTTP 422) Missing field: "head_sha" Missing field: "base_sha" No commits between master and cask-repair_update-airmail-beta Error creating pull request: Unprocessable Entity (HTTP 422) Missing field: "head_sha" Missing field: "base_sha" No commits between master and cask-repair_update-airmail-beta

There was an error submitting the pull request. Have you forked the repo and made sure the pull and push remotes exist?

zebastiane commented 8 years ago

I had the same error, and @hoasito's solution worked for me. Thanks.

howie commented 8 years ago

I still got same problem, no mater @hoasito 's and @nstCactus 's solution ~ Orz..

vitorgalvao commented 8 years ago

One more:

  1. Clone your own repo somewhere (not the main repo)
  2. Add the main repo as the upstream remote.
    1. This means you’ll now have your repo as origin and the main one as remote.
  3. Pull and merge changed from upstream.
  4. Try cask-repair.
jmsalcido commented 8 years ago

Well, I had to create the PR manually, but... cask-repair actually helped, thanks everyone.

vitorgalvao commented 8 years ago

Closing until I get a reply with this test.

What I know is this bug is either in hub, or in cask-repair’s command that uses hub. Look for the bug in question, and you’ll see multiple open and closed issues on hub’s issue tracker pertaining to them.

What I don’t know is precisely what is causing it or how to fix it. I’ve tried it in multiple ways, and I simply am not able to reproduce it. If anyone can figure it out, I’ll gladly take a PR or a suggestion in the right direction.

yurikoles commented 8 years ago

@vitorgalvao sorry, I had reproduced it, but I had forgot to report back. Now I tried it on another machine with same result, so please reopen.

vitorgalvao commented 8 years ago

I had reproduced it, but I had forgot to report back

So you tried these actions and still got the error?

yurikoles commented 8 years ago

@vitorgalvao yes. I'm now trying with recreated .gitconfig, only username and email have set and voila! https://github.com/caskroom/homebrew-versions/pull/2161 here is my old .gitconfig https://gist.github.com/yurikoles/5c41e9eeac02c2641c1e9c965a340680

yurikoles commented 8 years ago

I will try to play with different options from my old .gitconfig, especially

[push]
default = upstream
vitorgalvao commented 8 years ago

@yurikoles Ah, it seems like you’re onto something!

Can everyone else:

  1. Share their .gitconfig (omitting potentially private values, but not the keys).
  2. Try a .gitconfig with only a username and email.
yurikoles commented 8 years ago

@vitorgalvao so its seems like this option definitely, because I had successfully submitted this PR with all options same except this. I just removed it. https://github.com/caskroom/homebrew-versions/pull/2162

[push]
default = upstream
howie commented 8 years ago

Yes! I can confirm @yurikoles
After mark defalut = upstream , it work ! https://github.com/caskroom/homebrew-cask/pull/21697

yurikoles commented 8 years ago

@vitorgalvao please provide us a workaround or at least document the bug. Is it in cask-repair or in hub?

vitorgalvao commented 8 years ago

Definitely something that hub intends to work on.

Fortunately, it’s also something that it seems we can work around in with cask-repair.

Should be fixed in the now released version. Thank you all for the reports.

vitorgalvao commented 8 years ago

I’ve changed slightly how the fix works, so please let me know if you have issues again.

pat-s commented 8 years ago

Facing this issue when running cask-repair --pull origin --push pat-s jabref. Updating other casks works.

cd "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks"
cask-repair --pull origin --push pat-s jabref
cask 'jabref' do
  version '3.6'
  sha256 '1eabadccc6eca0c4a7157870509e8d5702351cf9f438d126e25859c92edae52a'

  # github.com/JabRef/jabref was verified as official when first introduced to the cask
  url "https://github.com/JabRef/jabref/releases/download/v#{version}/JabRef_macos_#{version.dots_to_underscores}.dmg"
  appcast 'https://github.com/JabRef/jabref/releases.atom',
          checkpoint: '0cff3ed91fec9ffd92eb9592882c38f7f630fbb57c17e50fc1bc70f997b77729'
  name 'JabRef'
  homepage 'https://www.jabref.org/'
  license :gpl

  installer script: 'JabRef Installer.app/Contents/MacOS/JavaApplicationStub',
            args:   [
                      '-q',
                      '-VcreateDesktopLinkAction$Boolean=false',
                      '-VaddToDockAction$Boolean=false',
                      '-VshowFileAction$Boolean=false',
                      '-Vsys.installationDir=/Applications',
                      '-VexecutionLauncherAction$Boolean=false',
                    ],
            sudo:   false

  uninstall delete: '/Applications/JabRef.app'
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Type the new version (or leave blank to use the current one)
> 3.6
==> Downloading external files for Cask ./jabref.rb
==> Downloading https://github.com/JabRef/jabref/releases/download/v3.6/JabRef_macos_3_6.dmg
######################################################################## 100,0%
==> No checksum defined for Cask jabref, skipping verification
==> Success! Downloaded to -> /Users/pjs/Library/Caches/Homebrew/Cask/jabref--3.6.dmg
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is everything correct? You can also make further manual edits (y/n/e) y
Submitting…
On branch cask-repair_update-jabref
nothing to commit, working tree clean
Error creating pull request: Unprocessable Entity (HTTP 422)
No commits between caskroom:master and pat-s:cask-repair_update-jabref
Error creating pull request: Unprocessable Entity (HTTP 422)
No commits between caskroom:master and pat-s:cask-repair_update-jabref

git remote --verbose

origin  https://github.com/caskroom/homebrew-cask (fetch)
origin  https://github.com/caskroom/homebrew-cask (push)
pat-s   https://github.com/pat-s/homebrew-cask.git (fetch)
pat-s   https://github.com/pat-s/homebrew-cask.git (push)
bondolo commented 7 years ago

Telling git my github public key resolved the issue for me:

GIT_SSH_COMMAND="ssh -i ~/.ssh/github.pub" cask-repair -i java-jdk-javadoc

vitorgalvao commented 7 years ago

@bondolo https://github.com/vitorgalvao/tiny-scripts/pull/87 should have fixed it, but if it hasn’t, I’ll keep your solution in mind. Thank you.