diff options
author | Sl@ny <webmaster@slany.work> | 2016-12-28 17:35:52 +0100 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-28 18:09:52 +0100 |
commit | c22f9114c7e0874e99fd1504131423517905c9c1 (patch) | |
tree | ed70854ca628597d961fbf44acf61f1c9f8e6f16 /vendor | |
parent | 331316894e391beb29fdebf9d8088973759bba1c (diff) | |
download | gitea-c22f9114c7e0874e99fd1504131423517905c9c1.tar.gz gitea-c22f9114c7e0874e99fd1504131423517905c9c1.zip |
Implementation of Folder Jumping
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/code.gitea.io/git/tree_entry.go | 19 | ||||
-rw-r--r-- | vendor/vendor.json | 6 |
2 files changed, 22 insertions, 3 deletions
diff --git a/vendor/code.gitea.io/git/tree_entry.go b/vendor/code.gitea.io/git/tree_entry.go index 1754316731..3f68d9868e 100644 --- a/vendor/code.gitea.io/git/tree_entry.go +++ b/vendor/code.gitea.io/git/tree_entry.go @@ -94,6 +94,25 @@ func (te *TreeEntry) Blob() *Blob { } } +// GetSubJumpablePathName return the full path of subdirectory jumpable ( contains only one directory ) +func (te *TreeEntry) GetSubJumpablePathName() string { + if te.IsSubModule() || !te.IsDir() { + return "" + } + tree, err := te.ptree.SubTree(te.name) + if err != nil { + return te.name + } + entries, _ := tree.ListEntries() + if len(entries) == 1 && entries[0].IsDir() { + name := entries[0].GetSubJumpablePathName() + if name != "" { + return te.name + "/" + name + } + } + return te.name +} + // Entries a list of entry type Entries []*TreeEntry diff --git a/vendor/vendor.json b/vendor/vendor.json index b440e48fbb..4382892edd 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -3,10 +3,10 @@ "ignore": "test", "package": [ { - "checksumSHA1": "OWuUWQ8sWC8n+eTQttx+3vfES8g=", + "checksumSHA1": "mIaKLz6373W+jDLjgE/Yzt/exeo=", "path": "code.gitea.io/git", - "revision": "634abd6a61c350a95f6b146c3a5fc323282608ae", - "revisionTime": "2016-12-22T08:49:21Z" + "revision": "3d0fa331865619d2f3a7a0fcf23670a389310954", + "revisionTime": "2016-12-28T14:57:51Z" }, { "checksumSHA1": "dnGaLR7sd9D5YpQZP4QUGZiEq+c=", |