{"action":"created","issue":{"url":"https://api.github.com/repos/prontolabs/pronto/issues/263","repository_url":"https://api.github.com/repos/prontolabs/pronto","labels_url":"https://api.github.com/repos/prontolabs/pronto/issues/263/labels{/name}","comments_url":"https://api.github.com/repos/prontolabs/pronto/issues/263/comments","events_url":"https://api.github.com/repos/prontolabs/pronto/issues/263/events","html_url":"https://github.com/prontolabs/pronto/issues/263","id":257676944,"node_id":"MDU6SXNzdWUyNTc2NzY5NDQ=","number":263,"title":"Problem with running pronto in a pre-commit hook","user":{"login":"grodowski","id":4991698,"node_id":"MDQ6VXNlcjQ5OTE2OTg=","avatar_url":"https://avatars1.githubusercontent.com/u/4991698?v=4","gravatar_id":"","url":"https://api.github.com/users/grodowski","html_url":"https://github.com/grodowski","followers_url":"https://api.github.com/users/grodowski/followers","following_url":"https://api.github.com/users/grodowski/following{/other_user}","gists_url":"https://api.github.com/users/grodowski/gists{/gist_id}","starred_url":"https://api.github.com/users/grodowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grodowski/subscriptions","organizations_url":"https://api.github.com/users/grodowski/orgs","repos_url":"https://api.github.com/users/grodowski/repos","events_url":"https://api.github.com/users/grodowski/events{/privacy}","received_events_url":"https://api.github.com/users/grodowski/received_events","type":"User","site_admin":false},"labels":[{"id":46130782,"node_id":"MDU6TGFiZWw0NjEzMDc4Mg==","url":"https://api.github.com/repos/prontolabs/pronto/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-14T10:53:43Z","updated_at":"2018-12-26T11:01:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hey!\r\n\r\nI have run into a problem with setting up pronto as a `pre-commit` git hook. \r\n\r\nGiven there are new rubocop warnings and I have the below script in `.git/hooks/pre-commit`...\r\n\r\n```sh\r\n#!/bin/bash\r\nbundle exec pronto run --staged --runner rubocop --exit-code\r\n```\r\n\r\nPronto does what is expected and shows the rubocop warnings when I run:\r\n\r\n```sh\r\ngit add .\r\ngit commit -m \"test\"\r\n```\r\n\r\nBut unfortunately I get no rubocop output and a false-positive exit status 0 on\r\n\r\n```sh\r\ngit commit -am \"test\"\r\n```\r\n\r\nThis is strange and I've been trying to understand the reason. Traced it back to the below line, where `rugged` returns an empty diff for the `staged` option (just in the second use case).\r\n\r\nhttps://github.com/prontolabs/pronto/blob/e97cb2b648206bd51b1a4784a282f474f9eb51e2/lib/pronto/git/repository.rb#L15\r\n\r\nAny help would be welcome!\r\n\r\nEdit: I am using pronto 0.9.5"},"comment":{"url":"https://api.github.com/repos/prontolabs/pronto/issues/comments/449950090","html_url":"https://github.com/prontolabs/pronto/issues/263#issuecomment-449950090","issue_url":"https://api.github.com/repos/prontolabs/pronto/issues/263","id":449950090,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTk1MDA5MA==","user":{"login":"printercu","id":1144890,"node_id":"MDQ6VXNlcjExNDQ4OTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1144890?v=4","gravatar_id":"","url":"https://api.github.com/users/printercu","html_url":"https://github.com/printercu","followers_url":"https://api.github.com/users/printercu/followers","following_url":"https://api.github.com/users/printercu/following{/other_user}","gists_url":"https://api.github.com/users/printercu/gists{/gist_id}","starred_url":"https://api.github.com/users/printercu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/printercu/subscriptions","organizations_url":"https://api.github.com/users/printercu/orgs","repos_url":"https://api.github.com/users/printercu/repos","events_url":"https://api.github.com/users/printercu/events{/privacy}","received_events_url":"https://api.github.com/users/printercu/received_events","type":"User","site_admin":false},"created_at":"2018-12-26T11:01:20Z","updated_at":"2018-12-26T11:01:20Z","author_association":"NONE","body":"Just faced this issue. Using master to resolve Rugged::TreeError.\r\n@mmozuras do you have any updates on how to make it work with both `--staged --index` given?\r\n\r\nAs a workaround I run pronto second time for new files:\r\n```bash\r\nbundle exec pronto run --index --exit-code\r\n\r\nnew_files=`git diff --cached --name-status | (grep -E \"^[A]\" || true) | cut -f2-`\r\n[ -n \"$new_files\" ] && bundle exec pronto run --staged --exit-code\r\n```"}}
{"actor":{"display_login":"printercu"}}