Changeset 711cfb4a6886…
Parent ad6ac7646c4c…
by
Changes to one file · Browse files at 711cfb4a6886 Showing diff from parent ad6ac7646c4c Diff from another changeset...
@@ -66,26 +66,36 @@ out, err := exec.Command("git", "config", "kiln.url").Output()
if err == nil && len(out) > 0 {
base, err = url.Parse(strings.TrimSpace(string(out)))
- } else {
- if strings.HasPrefix(s, "ssh://") {
- components := strings.SplitN(strings.TrimPrefix(s, "ssh://"), "/", 2)
- fullDomain := strings.Split(components[0], "@")
- domain := fullDomain[len(fullDomain)-1]
- rest := ""
- if len(components) > 1 {
- rest = components[1]
- }
- if strings.HasSuffix(domain, ".kilnhg.com") {
- s = "https://" + domain + "/Code/" + rest + ".git"
- }
- }
+ if err != nil {
+ err = fmt.Errorf("unable to parse kiln.url \"%s\"", string(out))
+ return
+ }
+ } else {
base, err = url.Parse(s)
- if err != nil || (base.Scheme != "http" && base.Scheme != "https") {
- err = fmt.Errorf("must either have an HTTP remote or kiln.url specified in config")
- return
- }
- }
-
+ if err != nil {
+ err = fmt.Errorf("unable to parse remote URL \"%s\"", s)
+ return
+ }
+ if base.Scheme != "http" && base.Scheme != "https" && base.Scheme != "ssh" {
+ err = fmt.Errorf("unsupport Kiln URL scheme: \"%s\"", s)
+ return
+ }
+ if base.Scheme == "ssh" {
+ if strings.HasPrefix(base.Host, "our.fogbugz.com") {
+ base.Host = "our.fogbugz.com"
+ base.Path = "/kiln/Code" + base.Path + ".git"
+ base.Scheme = "http"
+ } else if !strings.HasSuffix(base.Host, ".kilnhg.com") {
+ err = fmt.Errorf("cannot infer HTTP path to Kiln repository; please specify using kiln.url")
+ return
+ } else {
+ base.Scheme = "https"
+ base.Path = "/Code" + base.Path + ".git"
+ }
+ }
+ }
+
+ base.User = nil
components := strings.Split(base.Path, "/")
l := len(components)
components[l-1] = strings.TrimSuffix(components[l-1], ".git")
|
Loading...