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

Add support for git push with custom headers #2011

Closed
wants to merge 3 commits into from

Conversation

evolvedlight
Copy link

This is needed for pushing changes to bitbucket server repos

@@ -376,6 +376,7 @@ public virtual void Push(Remote remote, IEnumerable<string> pushRefSpecs, PushOp
PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
RemoteCallbacks = gitCallbacks,
ProxyOptions = new GitProxyOptions { Version = 1 },
CustomHeaders = pushOptions.CustomHeaders?.Length > 0 ? GitStrArrayManaged.BuildFrom(pushOptions.CustomHeaders) : new GitStrArrayManaged()

Choose a reason for hiding this comment

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

Is null better than new GitStrArrayManaged() here?

Choose a reason for hiding this comment

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

The CustomHeaders field is of type GitStrArrayManaged, which is a struct type so non-nullable value type. So not without some other impacting modifications I think.

@TackyTortoise
Copy link

Without this it is also seemingly impossible to push to Azure repository using a personal access token. I wonder why it was exposed in FetchOptions but not in PushOptions.

@@ -376,6 +376,7 @@ public virtual void Push(Remote remote, IEnumerable<string> pushRefSpecs, PushOp
PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
RemoteCallbacks = gitCallbacks,
ProxyOptions = new GitProxyOptions { Version = 1 },
CustomHeaders = pushOptions.CustomHeaders?.Length > 0 ? GitStrArrayManaged.BuildFrom(pushOptions.CustomHeaders) : new GitStrArrayManaged()
Copy link
Contributor

@James-LG James-LG Jul 25, 2023

Choose a reason for hiding this comment

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

GitStrArrayManaged needs to be disposed. I have a similar PR that does that here #2052 by following the pattern set by GitFetchOptionsWrapper.

@evolvedlight
Copy link
Author

Sorry, somehow I missed the notifications on the comment. Will close in favor of #2052

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

4 participants