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(submodule): cloning submodule using ssh url #464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hunter-Thompson
Copy link

Changed from net/url stdlib to git-urls

According to the function description it does the following things:

Parse parses rawurl into a URL structure. Parse first attempts to find a standard URL with a valid Git transport as its scheme. If that cannot be found, it then attempts to find a SCP-like URL. And if that cannot be found, it assumes rawurl is a local path. If none of these rules apply, Parse returns an error.

Example:

package main

import (
	"fmt"

	url "github.com/whilp/git-urls"
)

func main() {
	http, err := url.Parse("https://github.com/hello/hello.git")
	if err != nil {
		panic(err)
	}

	ssh, err := url.Parse("git@github.com:hello/hello.git")
	if err != nil {
		panic(err)
	}

	fmt.Printf("http: %s\n", http.Path)
	fmt.Printf("ssh: %s\n", ssh.Path)
}

returns:

http: /hello/hello.git
ssh: hello/hello.git

Fixes #397

@Hunter-Thompson
Copy link
Author

Im not sure how to add a new fixture for this test, can someone help me out with that?

@Hunter-Thompson
Copy link
Author

@mcuadros, can you review? This is quite a big bug.

@Hunter-Thompson
Copy link
Author

@mcuadros bump

@Harishkrishna17
Copy link

@mcuadros Any update here ?

@Hunter-Thompson
Copy link
Author

Here's an upstream fork that people can use until this is merged.

https://github.com/smallcase/go-git

v5.4.3

@alexec
Copy link

alexec commented Mar 24, 2022

I've review the changes in this PR:

  • The licence of the lib it MIT.
  • This supports the git URL format.
  • Does it need a test?

@tcolgate
Copy link

FWIW, this fix (as present in hte argo fork, doesn't seem to work for me), I thin it is passing the wrong URL on to github...

2022/04/12 09:21:23 err cloning, pkt-line 1: invalid hash text: encoding/hex: invalid byte: U+0052 'R' (ERR 
  myorg/myrepo.git/myorg/mysubrepo is not a valid repository name
  Visit https://support.github.com/ for help)

@tcolgate
Copy link

For submodules specified with an absolute URL this is also needed...
argoproj-labs#3

@mattbucci
Copy link

This was patched in the Digital Ocean fork here: digitalocean#5

@github-actions github-actions bot added the stale Issues/PRs that are marked for closure due to inactivity label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues/PRs that are marked for closure due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to clone repository with submodule url git@github.com:
5 participants