(fs billy.Filesystem)
| 426 | } |
| 427 | |
| 428 | func dotGitCommonDirectory(fs billy.Filesystem) (commonDir billy.Filesystem, err error) { |
| 429 | f, err := fs.Open("commondir") |
| 430 | if os.IsNotExist(err) { |
| 431 | return nil, nil |
| 432 | } |
| 433 | if err != nil { |
| 434 | return nil, err |
| 435 | } |
| 436 | |
| 437 | b, err := io.ReadAll(f) |
| 438 | if err != nil { |
| 439 | return nil, err |
| 440 | } |
| 441 | if len(b) > 0 { |
| 442 | path := strings.TrimSpace(string(b)) |
| 443 | if filepath.IsAbs(path) { |
| 444 | commonDir = osfs.New(path) |
| 445 | } else { |
| 446 | commonDir = osfs.New(filepath.Join(fs.Root(), path)) |
| 447 | } |
| 448 | if _, err := commonDir.Stat(""); err != nil { |
| 449 | if os.IsNotExist(err) { |
| 450 | return nil, ErrRepositoryIncomplete |
| 451 | } |
| 452 | |
| 453 | return nil, err |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | return commonDir, nil |
| 458 | } |
| 459 | |
| 460 | // PlainClone a repository into the path with the given options, isBare defines |
| 461 | // if the new repository will be bare or normal. If the path is not empty |
no test coverage detected
searching dependent graphs…