MCPcopy Index your code
hub / github.com/dagger/dagger / git

Method git

core/schema/git.go:200–734  ·  view source on GitHub ↗

nolint:gocyclo

(ctx context.Context, parent dagql.ObjectResult[*core.Query], args gitArgs)

Source from the content-addressed store, hash-verified

198
199//nolint:gocyclo
200func (s *gitSchema) git(ctx context.Context, parent dagql.ObjectResult[*core.Query], args gitArgs) (inst dagql.ObjectResult[*core.GitRepository], _ error) {
201 srv, err := core.CurrentDagqlServer(ctx)
202 if err != nil {
203 return inst, fmt.Errorf("failed to get current dagql server: %w", err)
204 }
205 curCall := dagql.CurrentCall(ctx)
206 if curCall == nil {
207 return inst, fmt.Errorf("current call is nil")
208 }
209
210 var experimentalServiceHostID *call.ID
211 if args.ExperimentalServiceHost.Valid {
212 experimentalServiceHostID, err = args.ExperimentalServiceHost.Value.ID()
213 if err != nil {
214 return inst, fmt.Errorf("experimental service host ID: %w", err)
215 }
216 }
217 var sshAuthSocketID *call.ID
218 if args.SSHAuthSocket.Valid {
219 sshAuthSocketID, err = args.SSHAuthSocket.Value.ID()
220 if err != nil {
221 return inst, fmt.Errorf("ssh auth socket ID: %w", err)
222 }
223 }
224 var httpAuthTokenID *call.ID
225 if args.HTTPAuthToken.Valid {
226 httpAuthTokenID, err = args.HTTPAuthToken.Value.ID()
227 if err != nil {
228 return inst, fmt.Errorf("http auth token ID: %w", err)
229 }
230 }
231 var httpAuthHeaderID *call.ID
232 if args.HTTPAuthHeader.Valid {
233 httpAuthHeaderID, err = args.HTTPAuthHeader.Value.ID()
234 if err != nil {
235 return inst, fmt.Errorf("http auth header ID: %w", err)
236 }
237 }
238
239 remote, err := gitutil.ParseURL(args.URL)
240 if errors.Is(err, gitutil.ErrUnknownProtocol) {
241 candidates, candErr := gitutil.ParseCloneURL(args.URL)
242 if candErr != nil {
243 return inst, fmt.Errorf("failed to parse Git URL: %w", candErr)
244 }
245 try := make([][]dagql.NamedInput, 0, len(candidates))
246 for _, candidate := range candidates {
247 try = append(try, []dagql.NamedInput{
248 {Name: "url", Value: dagql.NewString(candidate.String())},
249 })
250 }
251 if args.Commit != "" {
252 for i := range try {
253 try[i] = append(try[i], dagql.NamedInput{
254 Name: "commit",
255 Value: dagql.NewString(args.Commit),
256 })
257 }

Callers

nothing calls this directly

Calls 15

CurrentDagqlServerFunction · 0.92
CurrentCallFunction · 0.92
ParseURLFunction · 0.92
ParseCloneURLFunction · 0.92
NewStringFunction · 0.92
OptFunction · 0.92
NewBooleanFunction · 0.92
DNSConfigFunction · 0.92
WithDNSConfigFunction · 0.92
WarnFunction · 0.92

Tested by

no test coverage detected