Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(service): push to protected branches #1614

Merged
merged 4 commits into from Oct 18, 2020
Merged

fix(service): push to protected branches #1614

merged 4 commits into from Oct 18, 2020

Conversation

jsam
Copy link
Contributor

@jsam jsam commented Oct 15, 2020

No description provided.

if origin.refs and repo.active_branch in origin.refs:
origin.fetch()
origin.pull(repo.active_branch)

origin.push(repo.active_branch)
result = origin.push(repo.active_branch)
if result and "[remote rejected] (pre-receive hook declined)" in result[0].summary:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird that git itself returns something like ! [remote rejected] master -> master (protected branch hook declined) but GitPython returns [remote rejected] (pre-receive hook declined) without the branch->branch part.

I wonder if there's a case where GitPython might also return the longer message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think GitPython only captures the last part of the message. It's also very strange that they don't raise exception on git error anymore but return the InfoResult object. 🤷

@jsam jsam merged commit 34c7f92 into master Oct 18, 2020
@jsam jsam deleted the 00_protected branch October 18, 2020 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants