(url string, action SmartServiceAction)
| 72 | } |
| 73 | |
| 74 | func (t *httpSmartSubtransport) Action(url string, action SmartServiceAction) (SmartSubtransportStream, error) { |
| 75 | var req *http.Request |
| 76 | var err error |
| 77 | switch action { |
| 78 | case SmartServiceActionUploadpackLs: |
| 79 | req, err = http.NewRequest("GET", url+"/info/refs?service=git-upload-pack", nil) |
| 80 | |
| 81 | case SmartServiceActionUploadpack: |
| 82 | req, err = http.NewRequest("POST", url+"/git-upload-pack", nil) |
| 83 | if err != nil { |
| 84 | break |
| 85 | } |
| 86 | req.Header.Set("Content-Type", "application/x-git-upload-pack-request") |
| 87 | |
| 88 | case SmartServiceActionReceivepackLs: |
| 89 | req, err = http.NewRequest("GET", url+"/info/refs?service=git-receive-pack", nil) |
| 90 | |
| 91 | case SmartServiceActionReceivepack: |
| 92 | req, err = http.NewRequest("POST", url+"/info/refs?service=git-upload-pack", nil) |
| 93 | if err != nil { |
| 94 | break |
| 95 | } |
| 96 | req.Header.Set("Content-Type", "application/x-git-receive-pack-request") |
| 97 | |
| 98 | default: |
| 99 | err = errors.New("unknown action") |
| 100 | } |
| 101 | |
| 102 | if err != nil { |
| 103 | return nil, err |
| 104 | } |
| 105 | |
| 106 | req.Header.Set("User-Agent", "git/2.0 (git2go)") |
| 107 | |
| 108 | stream := newManagedHttpStream(t, req) |
| 109 | if req.Method == "POST" { |
| 110 | stream.recvReply.Add(1) |
| 111 | stream.sendRequestBackground() |
| 112 | } |
| 113 | |
| 114 | return stream, nil |
| 115 | } |
| 116 | |
| 117 | func (t *httpSmartSubtransport) Close() error { |
| 118 | return nil |
nothing calls this directly
no test coverage detected