diff options
author | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-11 12:29:33 +0530 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-11 12:29:33 +0530 |
commit | d62fb1442bc300dcee2a7c6a9c374201ba1c7ae6 (patch) | |
tree | 045aa85469c9f9e66709f27685158443f8530591 /git | |
parent | 856f66808b913baff13c815daec3cdde7121e3bd (diff) | |
download | legit-d62fb1442bc300dcee2a7c6a9c374201ba1c7ae6.tar.gz legit-d62fb1442bc300dcee2a7c6a9c374201ba1c7ae6.tar.bz2 legit-d62fb1442bc300dcee2a7c6a9c374201ba1c7ae6.zip |
git: fetch files only using ref
Diffstat (limited to 'git')
-rw-r--r-- | git/git.go | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -31,17 +31,8 @@ type NiceTree struct { IsFile bool } -func FilesAtHead(r *git.Repository, path string) ([]NiceTree, error) { - head, err := r.Head() - if err != nil { - return nil, fmt.Errorf("getting head: %w", err) - } - - return FilesAtRef(r, head, path) -} - -func FilesAtRef(r *git.Repository, ref *plumbing.Reference, path string) ([]NiceTree, error) { - c, err := r.CommitObject(ref.Hash()) +func FilesAtRef(r *git.Repository, hash plumbing.Hash, path string) ([]NiceTree, error) { + c, err := r.CommitObject(hash) if err != nil { return nil, fmt.Errorf("commit object: %w", err) } |