Skip to content

Conversation

@glichtner
Copy link
Contributor

Add Proxy Support to git2r

This pull request introduces proxy support to the git2r package.

Summary of Changes

  • Proxy Argument Addition:
    R Functions clone, fetch, push, and remote_ls now include a proxy parameter, enabling users to define proxy settings directly within these functions.

  • Proxy Options Handling:
    Implementation of internal functions to manage proxy settings, including validation and integration with libgit2's proxy options.

  • Documentation Updates:
    Enhancements to the documentation to reflect the new proxy parameter, providing guidance on its usage and possible values.

  • Test Coverage:
    Added basic tests for all functions that implement the proxy parameter.

Details

Functions Updated

  • clone: Added proxy parameter to specify proxy settings during repository cloning.
  • fetch: Included proxy parameter to define proxy settings when fetching updates from a remote repository.
  • push: Integrated proxy parameter to set proxy settings during push operations.
  • remote_ls: Enhanced to accept a proxy parameter for listing references in a remote repository through a proxy.

Proxy Parameter

The proxy parameter takes the following values (corresponding to libgit2`s git_proxy_t):

  • NULL: No proxy used (default)
  • TRUE: Try to auto-detect the proxy from the git configuration.
  • character vector: Connect via the URL given in the options

Internal Functions

  • git2r_set_proxy_options: New function to initialize and set proxy options based on user input.
  • git2r_arg_check_proxy: Validation function to ensure the provided proxy arguments are of acceptable types (NULL, TRUE, or a valid string).

Documentation

  • Updated manual pages for all modified functions to include descriptions and usage examples for the proxy parameter.

Related issues

Should fix #395 , #278, and possibly #269 .

@stewid
Copy link
Member

stewid commented Jan 10, 2025

Thanks for the pull request. I'll check it out in the next few days.

@stewid stewid merged commit af1b35f into ropensci:main Jan 15, 2025
4 checks passed
@stewid
Copy link
Member

stewid commented Jan 15, 2025

Thanks

@glichtner
Copy link
Contributor Author

glichtner commented Jan 20, 2025

@stewid Happy to contribute!

I'm not sure why the CI tests failed on ubuntu-latest (devel) after merging (https://github.com/ropensci/git2r/actions/runs/12797680530/job/35680105737). They succeeded in the PR. Is it possible that some of the ubuntu runners on github do not have libgit2 installed, and that the CI workflow should run a "install libgit2" not only on macos runners, but on all runners, just for good measure?

Possible change to the workflow file could be:

- name: Install libgit2 on macOS and Ubuntu
  run: |
    if [ "$RUNNER_OS" == "macOS" ]; then
      brew install libgit2
    elif [ "$RUNNER_OS" == "Linux" ]; then
      sudo apt-get update && sudo apt-get install -y libgit2-dev
    fi
  shell: bash

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.

Handle (authenticating) proxy setting

2 participants