func getParentDir()

in internal/repo/directory.go [27:42]


func getParentDir(dir string) string {
	trimmedDir := strings.TrimSuffix(dir, "/")

	// Handle root
	if trimmedDir == "" {
		return "/"
	}

	lastIndex := strings.LastIndex(trimmedDir, "/")
	if lastIndex == -1 {
		return "/" // File in root directory
	}

	// Remove remaining portion of last directory
	return trimmedDir[:lastIndex+1]
}