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

Automatically detecting smart Git hosts #1628

Merged
merged 4 commits into from
Mar 26, 2015

Commits on Mar 24, 2015

  1. Automatically detecting _smart Git hosts_.

    Added logic to automatically detect smart Git hosts that allow shallow
    cloning. This is done by sending an `ls-remote` request to the server
    and then evaluating the returned HTTP header fields. For this, Curl
    verbose logging is enabled for the `ls-remote` request, since Curl
    verbose logging sends the returned HTTP headers to `stderr`.
    
    If the `stderr` output contains the desired header
    
      Content-Type: application/x-git-upload-pack-advertisement
    
    then the server supports shallow cloning.
    
    This approach uses Git and Curl for the heavy lifting. Instead of
    implementing the request to the server using a simple HTTP client, Git
    is used, since it takes care of authentication using stored credentials.
    
    The used approach should also work for BitBucket, which only sends the
    Content-Type header when a specific user agent is used. Using Git to
    make the request enables this behavior.
    
    The function to detect the smart Git host
    (`GitRemoteResolver.prototype._supportsShallowCloning`) returns a
    promise that is resolved when the server's request is evaluated. The
    promise handling required an addition to `GitHubResolver.js` - to always
    resolve the promise to `true`, since GitHub supports shallow cloning.
    
    Added test cases to verify the new functionality.
    nwinkler committed Mar 24, 2015
    Configuration menu
    Copy the full SHA
    4ad5ed6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a352d51 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    912808b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7e0a2ea View commit details
    Browse the repository at this point in the history