MCPcopy Index your code
hub / github.com/go-git/go-git / checkIfCleanupIsNeeded

Function checkIfCleanupIsNeeded

repository.go:511–535  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

509}
510
511func checkIfCleanupIsNeeded(path string) (cleanup bool, cleanParent bool, err error) {
512 fi, err := osfs.Default.Stat(path)
513 if err != nil {
514 if os.IsNotExist(err) {
515 return true, true, nil
516 }
517
518 return false, false, err
519 }
520
521 if !fi.IsDir() {
522 return false, false, fmt.Errorf("path is not a directory: %s", path)
523 }
524
525 files, err := osfs.Default.ReadDir(path)
526 if err != nil {
527 return false, false, err
528 }
529
530 if len(files) == 0 {
531 return true, false, nil
532 }
533
534 return false, false, nil
535}
536
537func cleanUpDir(path string, all bool) error {
538 if all {

Callers 1

PlainCloneContextFunction · 0.85

Calls 3

StatMethod · 0.65
IsDirMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…