diff options
author | Michael Muré <batolettre@gmail.com> | 2021-03-21 18:22:04 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-03-21 18:22:04 +0100 |
commit | 5215634d0dca37c545904fbc8a12ddd9b8eb72df (patch) | |
tree | ee8094fe3eacd9c732cdd489a37340fdcaf1e678 /repository | |
parent | 214abe4dea1984086e45d1399538fb12aa010642 (diff) | |
download | git-bug-5215634d0dca37c545904fbc8a12ddd9b8eb72df.tar.gz |
entity: add support for storing files
Diffstat (limited to 'repository')
-rw-r--r-- | repository/tree_entry.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/repository/tree_entry.go b/repository/tree_entry.go index 6c5ec1a5..9d70814c 100644 --- a/repository/tree_entry.go +++ b/repository/tree_entry.go @@ -100,3 +100,13 @@ func readTreeEntries(s string) ([]TreeEntry, error) { return casted, nil } + +// SearchTreeEntry search a TreeEntry by name from an array +func SearchTreeEntry(entries []TreeEntry, name string) (TreeEntry, bool) { + for _, entry := range entries { + if entry.Name == name { + return entry, true + } + } + return TreeEntry{}, false +} |