mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 03:03:32 +01:00
Bug fixes: - Fix inverted pager detection logic (returned error instead of path) - Fix repo.Clone ignoring destination directory parameter - Fix sheet loading using append on pre-sized slices - Clean up partial files on copy failure - Trim whitespace from editor config Security: - Add path traversal protection for cheatsheet names Performance: - Move regex compilation outside search loop - Replace string concatenation with strings.Join in search Build: - Remove go:generate; embed config and usage as string literals - Parallelize release builds - Add fuzz testing infrastructure Testing: - Improve test coverage from 38.9% to 50.2% - Add fuzz tests for search, filter, tags, and validation Documentation: - Fix inaccurate code examples in HACKING.md - Add missing --conf and --all options to man page - Add ADRs for path traversal, env parsing, and search parallelization - Update CONTRIBUTING.md to reflect project policy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
550 B
Go
27 lines
550 B
Go
// Package repo implements functions pertaining to the management of git repos.
|
|
package repo
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/go-git/go-git/v5"
|
|
)
|
|
|
|
// Clone clones the community cheatsheets repository to the specified directory
|
|
func Clone(dir string) error {
|
|
|
|
// clone the community cheatsheets
|
|
_, err := git.PlainClone(dir, false, &git.CloneOptions{
|
|
URL: "https://github.com/cheat/cheatsheets.git",
|
|
Depth: 1,
|
|
Progress: os.Stdout,
|
|
})
|
|
|
|
if err != nil {
|
|
return fmt.Errorf("failed to clone cheatsheets: %v", err)
|
|
}
|
|
|
|
return nil
|
|
}
|