Skip to content

Don't fail silently on server side git push rejections#6182

Merged
dkurepa merged 2 commits intomainfrom
dkurepa/Lib2GitPushFix
Apr 15, 2026
Merged

Don't fail silently on server side git push rejections#6182
dkurepa merged 2 commits intomainfrom
dkurepa/Lib2GitPushFix

Conversation

@dkurepa
Copy link
Copy Markdown
Member

@dkurepa dkurepa commented Apr 15, 2026

This makes it so we don't fail silently on server side rejections. Previously we were only getting transport related errors
#6181

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error reporting for git push operations in Darc’s LibGit2Sharp-based client so that server-side push rejections (e.g., protected branch / hook declined) no longer fail silently, addressing #6181.

Changes:

  • Add PushOptions.OnPushStatusError handling to surface server-side push status errors as exceptions during Push.

Comment on lines +419 to +422
OnPushStatusError = error =>
{
throw new LibGit2SharpException($"Failed to push {error.Reference}: {error.Message}");
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

OnPushStatusError throws LibGit2SharpException, which will be treated as retryable by the _exponentialRetry predicate (ex is LibGit2SharpException). For server-side rejections (e.g., protected branch/hook declined), retrying is unlikely to succeed and may just add delay/log noise. Consider throwing a distinct exception type for push rejections (or narrowing the retry predicate) so only transient transport failures are retried; also consider including the remote URL/refspec in the exception message to aid diagnostics.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

that's fair, will turn it to a DarcException

@dkurepa dkurepa enabled auto-merge (squash) April 15, 2026 08:57
@dkurepa dkurepa merged commit a13c67a into main Apr 15, 2026
9 of 11 checks passed
@dkurepa dkurepa deleted the dkurepa/Lib2GitPushFix branch April 15, 2026 12:42
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.

3 participants