aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-03-21 18:22:04 +0100
committerMichael Muré <batolettre@gmail.com>2021-03-21 18:22:04 +0100
commit5215634d0dca37c545904fbc8a12ddd9b8eb72df (patch)
treeee8094fe3eacd9c732cdd489a37340fdcaf1e678 /repository
parent214abe4dea1984086e45d1399538fb12aa010642 (diff)
downloadgit-bug-5215634d0dca37c545904fbc8a12ddd9b8eb72df.tar.gz
entity: add support for storing files
Diffstat (limited to 'repository')
-rw-r--r--repository/tree_entry.go10
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
+}