aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/tree_blob.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-07-26 02:28:04 -0400
committerUnknwon <joe2010xtmf@163.com>2014-07-26 02:28:04 -0400
commit5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635 (patch)
tree213666141efaf773c4411d41482387f1250068f8 /modules/git/tree_blob.go
parent3f38ff6c09f0497980ad13fda9803907cee6d612 (diff)
downloadgitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.tar.gz
gitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.zip
Huge updates!!!!! Be careful to merge!!!!
Diffstat (limited to 'modules/git/tree_blob.go')
-rw-r--r--modules/git/tree_blob.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/git/tree_blob.go b/modules/git/tree_blob.go
index debc722bc9..f996aba376 100644
--- a/modules/git/tree_blob.go
+++ b/modules/git/tree_blob.go
@@ -44,3 +44,16 @@ func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
}
return nil, fmt.Errorf("GetTreeEntryByPath: %v", ErrNotExist)
}
+
+func (t *Tree) GetBlobByPath(rpath string) (*Blob, error) {
+ entry, err := t.GetTreeEntryByPath(rpath)
+ if err != nil {
+ return nil, err
+ }
+
+ if !entry.IsDir() {
+ return entry.Blob(), nil
+ }
+
+ return nil, ErrNotExist
+}