-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Git-Trees API. #4185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Git-Trees API. #4185
Changes from all commits
Commits
Show all changes
450 commits
Select commit
Hold shift + click to select a range
7c45a55
Fix incorrect caption of webhook setting (#4701) (#4717)
SagePtr 48338e1
[skip ci] Updated translations via Crowdin
GiteaBot a59c455
Remove UsePrivilegeSeparation from the Docker sshd_config, see #2876 …
theasp bf6c63d
[skip ci] Updated translations via Crowdin
GiteaBot 7b4bcc4
Fix failure on creating pull request with assignees (#4419) (#4583)
SagePtr 99f0e54
[skip ci] Updated translations via Crowdin
GiteaBot ed04816
Add whitespace between chinese characters and english characters. (#4…
46905a3
Display error when adding a user to a team twice (#4746)
adelowo 45a60f1
allow WIP marker to contains < or > (#4709)
JulienTant 623d021
User shouldn't be able to approve or reject his/her own PR (#4729)
adelowo 37c34e0
add letsencrypt to Gitea (#4189)
7a950a2
[skip ci] Updated translations via Crowdin
GiteaBot 6598e98
Fixed bug where team with admin privelege type doesn't get any unit a…
adelowo f658384
Make sure to reset commit count in the cache on mirror syncing (#4720)
adelowo b92db71
[skip ci] Updated translations via Crowdin
GiteaBot 59b1daa
Add myself to maintainers (#4777)
adelowo 5b9c8fe
[skip ci] Updated translations via Crowdin
GiteaBot d5ed153
MySQL TLS (#4642)
aunger 897b865
API /admin/users/{username} missing parameter (#4775)
eb7742b
Don't disclose emails of all users when sending out emails (#4664)
techknowlogick 6814c26
Disable 'May Import Local Repository' when is disabled by setting (Is…
a26fd26
Update en-us and fr-fr versions of the "Upgrade from Gogs" doc (#4618)
deoren 25c34d8
Fix missing release title in webhook (#4783) (#4796)
SagePtr 5fe2746
Hide home button when landing page is not set to home (#4651)
0rzech 1b821d2
Add Orzech to translator list (#4801)
0rzech c53e546
Locale for Edit and Remove due date issue (#4802)
webjoel 5068374
Update legacy branch and tag URLs in dashboard to new format (#4812)
SagePtr 8bb9520
[skip ci] Updated translations via Crowdin
GiteaBot 0328acb
Upgrade images in .drone.yml to more recent versions (#4819)
techknowlogick f74cad1
[skip ci] Updated translations via Crowdin
GiteaBot 7cc0d40
update image used for build-without-gcc step (#4818)
techknowlogick 9eb63b0
Make reverse proxy auth optional (#4643)
e85daf1
Minor fix to TRANSLATORS (#4836)
SagePtr 1b5ec15
[skip ci] Updated translations via Crowdin
GiteaBot 48928cc
Add missing History link to directory listings (#4829)
decke af5435f
[skip ci] Updated translations via Crowdin
GiteaBot 59fdb8c
Backport 1.5.1 changelog (#4854)
techknowlogick 9905e9a
issues api allow pulls and fix #4832 (#4852)
lunny 0b05cd0
Fix trimming of markup section names (#4863)
Eisfunke d38aeda
update comparsion docs to add file viewer items (#4865)
lunny 72429b3
Punctuation changes in documentation (#4866)
maiki ec90e15
Remove feature `global code search` from GitLab CE (#4875)
codescale fca09a5
docs(comparison): correct GitLab CE multiple assignees for issues (#4…
max-wittig 4318e91
Do not autocreate directory for new user/orgs (#4828) (#4849)
SagePtr ebcb8bc
offline use of fonts (#4872)
techknowlogick df943b2
Fix redirect with non-ascii branch names (#4764) (#4810)
SagePtr 4ed80ae
Add push webhook support for mirrored repositories (#4127)
lafriks 60b4e64
Improve dependency UI (#4503)
lafriks 0c402a8
Extract header and footer content to separate tmpl (#4797)
lukasbestle 7ef246f
Add sudo functionality to the API (#4809)
zeripath b6c878d
Fixes repo branch endpoint summary (#4893)
Lewiscowles1986 f152851
[skip ci] Updated translations via Crowdin
GiteaBot 691eb27
Move README_ZH.md Screenshots to Bottom (#4895)
vcaesar 112ef3c
fix: Crippled diff (#4726) (#4900)
tonivj5 0304456
[skip ci] Updated translations via Crowdin
GiteaBot 2fe11b7
Slack webhook channel name cannot be empty or just contain an hashtag…
adelowo 6ac2094
[skip ci] Updated translations via Crowdin
GiteaBot b413dd7
allow api to create tags for releases (#4890)
Bobonium 72accef
Enforce token on api routes [fixed critical security issue #4357] (#4…
beeonthego 667f119
Add file name and branch to page title (#4902)
adelowo 42a2aad
Remove traces of embedded TiDB (#4906)
techknowlogick 740e3d6
[skip ci] Updated translations via Crowdin
GiteaBot 5c7eeb7
Remove zookeeper documentation (#4910)
549934b
[skip ci] Updated translations via Crowdin
GiteaBot f0ede64
Fix: Let's Encrypt configuration settings (#4911)
drewbowering adc13ad
Add/remove/list oauth providers via cli (#4591)
techknowlogick 8910c49
[skip ci] Updated translations via Crowdin
GiteaBot de08694
feat(repo): support search repository by topic name (#4505)
appleboy fcf365e
Fix bug when repo remained bare if multiple branches pushed (#4923)
SagePtr 55e7e1d
Force user to change password (#4489)
adelowo a64c719
fix bug forget to remove Stopwatch when remove repository (#4928)
linweijie2012 d0f5292
Allow admin toggle forcing a password change for newly created users …
adelowo 15064a3
doc: add Cloudron package (#4937)
gramakri d7c2fa9
[skip ci] Updated translations via Crowdin
GiteaBot 5e2a1d4
fix(topics): don't redirect to expole page. (#4938)
appleboy 3a05893
make sure to catch the right error so it is displayed as an error on …
adelowo afe0379
Fix some issues with special chars in branch names (#3767)
nubenum d847a98
Code review UI improvements and bugfixes (#4682)
lafriks caf33a0
fix url in discord webhook (#4953)
esno 66f33b6
[skip ci] Updated translations via Crowdin
GiteaBot 228826d
Fix interpunction in English translation. (#4958)
bugreport0 64d8e7a
[skip ci] Updated translations via Crowdin
GiteaBot 58491da
Fix null pointer dereference in ParseCommitWithSignature (#4962)
SagePtr 82d441b
[skip ci] Updated translations via Crowdin
GiteaBot 3e7e7f4
Fix #4877 to follow the OpenID Connect Audiences spec (#4878)
OvermindDL1 f055495
ADD: Hint to function of docker version tags (#4967)
Wyall 8e9d23d
Update Swagger API to match the return of /users/search (#4847)
zeripath dd4314b
Fix preview when adding new code review comment (#4975)
lafriks 974b34a
[skip ci] Updated translations via Crowdin
GiteaBot 1e59f29
Adjust maintainers (#4979)
46e07e3
[skip ci] Updated translations via Crowdin
GiteaBot ef96951
Fix user menu item styling (#4985)
silverwind 9d177bb
make sure milestone listing is consistent across board (#4987)
adelowo 29a20d9
Fix layout of the topics editing form (#4971)
kzmi b90c97a
Detect charset and convert non UTF-8 files for display (#4950)
lafriks 981c638
Fix #rrggbbaa color to rgba for better browser compatibility (#4990)
SagePtr bb0a40d
Disable debug routes unless PPROF is enabled in configuration (#4995)
lafriks 350aa83
[skip ci] Updated translations via Crowdin
GiteaBot 8d0d9b6
Upgrade gopkg.in/testfixtures.v2 (#4999)
typeless 63f15cc
[skip ci] Updated translations via Crowdin
GiteaBot 0004af3
README: update make command to build full release (#5004)
d587f36
Add missing envionment vars for DB with Docker (#5007)
Xiol b47751a
Fix a typo in app.ini.sample (#5015)
yan12125 e46a55f
Hide outdated comments in file view (#5017)
jonasfranz dcfb0bd
Fix missing AppSubUrl in some templates (#5020)
SagePtr 13b4eaf
Fix missing AppSubUrl in few more templates (#5021)
SagePtr f5869a4
Remove links from topics in edit mode (#5026)
SagePtr 1542444
Fix adding review comment in split view (#5038)
lafriks 50cfaa6
Backport 1.5.2 changelog (#5053)
techknowlogick 3f4c472
Add HOWTO for releasing Gitea (#5054)
techknowlogick f8b14f2
Fixed spelling typos in CONTRIBUTING.md (#5061)
SagePtr d22f137
Fix golint to new URL (#5079)
lafriks e925f52
Fix dep for actual goth version used in dep lock file (#5078)
lafriks 194ed38
fix release creation via API (#5076)
lunny 6e8b8e0
CN translation of README (#5050)
BetaCat0 6e81f3d
Update process to include tag vX.Y.0-dev on master branch (#5091)
lafriks 59849af
ZH-CN translation of Advanced part (#5090)
BetaCat0 bb267f2
[skip ci] Updated translations via Crowdin
GiteaBot eb826f1
Add change log for 1.6.0-rc1 (#5095)
lunny a8182a3
[skip ci] Updated translations via Crowdin
GiteaBot 83f7843
ZH-CN translation of Usage part (#5086)
BetaCat0 0cc3320
add myself to maintainers (#5098)
kolaente 88e62d7
[skip ci] Updated translations via Crowdin
GiteaBot 5eecb9a
CN translation of README (#5049)
BetaCat0 9a8897f
Fix regex to support optional end line of old section in diff hunk (#…
kolaente 41fc619
feat(topic): search keyword by splitting provided values by , (#4939)
appleboy ccd33cf
Add myself to maintainers (#5101)
BetaCat0 aa2d183
Use fingerprint in place of id (#5099)
sapk fc8e16d
refactor: err != nil check, just return error instead (#5093)
appleboy d9e8366
ZH-CN translation of Installation part (#5089)
BetaCat0 0f82261
Use native go method to get current user rather than environment vari…
SagePtr e9dfce0
Use APP_NAME on home page (#5048)
mcnesium b5797da
Add support for search by uid (#4876)
zeripath f596178
Add notification interface and refactor UI notifications (#5085)
lunny b8529e2
Fix home page template regression (#5102)
darktohka afc156a
Make switch more clear (#5119)
cristaloleg ff4d1ce
[skip ci] Updated translations via Crowdin
GiteaBot 381d561
Fix deadlock when sqlite (#5118)
lunny d28ab73
Remove duplicated if bodies (#5121)
cristaloleg 3aa4da0
Use type switch (#5122)
cristaloleg d1ef32a
Use named const instead of a raw string (#5115)
cristaloleg 7ff1d1d
Give user a link to create PR after push (#4716)
JulienTant 8b1276c
Add LFS timeout issue to troubleshooting doc (#5129)
ravenscroftj bf52578
fix fading menu in arc-green theme (#5128)
glaszig 2ae67fb
Retry test-fixtures loading in case of transaction rollback (#5125)
typeless 1a59c90
Remove check for negative length (#5120)
cristaloleg 692c9ae
Add must-change-password flag to cli for creating a user (#4955)
adelowo 9fb741b
Fix SQL quoting (#5117)
filipnavara 1f72e70
Fix Swagger JSON autogeneration issues. (#4845)
zeripath 4335971
Increase the retry limit to 20 times and the interval to 200ms (#5134)
typeless 919b06d
Add comment replies (#5104)
jonasfranz 8f39249
User action heatmap (#5131)
kolaente 121cd6c
Update vendor/go-sqlite3 (#5133)
typeless 35f7eb4
Update build tags for sqlite_unlock_notify (#5144)
typeless 1cef59e
Update outdated Go toolchain version for .drone.yml (#5146)
typeless 5776bb4
Update the docs for sqlite_unlock_notify (#5145)
typeless 2743b29
Update vendor/github.com/mattn/go-sqlite3 (#5162)
typeless 7aa43ea
Fix JSON result of empty array (#5154)
sapk 5cf2e9f
[skip ci] Updated translations via Crowdin
GiteaBot fd39667
Set heatmap color range configurable (#5165)
sapk d05774a
revert #5146 (#5167)
sapk da617fc
[skip ci] Updated translations via Crowdin
GiteaBot 8fc2f72
Disable sqlite test (#5178)
typeless e53276c
Fix sqlite lock (#5176)
lunny 87e7522
Update go-macaron/session to latest mast to fix RCE-bug (#5177)
bkcsoft cf56d46
Fix race on updatesize (#5190)
lunny 257890c
[skip ci] Updated translations via Crowdin
GiteaBot 012ea4a
Update TRANSLATORS (#5194)
briolantonio 7633d03
Update x/net (#5169)
sapk 60aa671
Update vendor/golang.org/x/sys (#5059)
tuxillo 9249c13
fix sqlite lock (#5184)
lunny 068217c
Update with-docker.en-us.md (#5203)
pestrickland fadb78c
Fix to 3819 - Filtering issues by tags on main screen issues (#3824)
rvillablanca 13dc611
fix: Add secret to all webhook's payload where it has been missing (#…
HoffmannP 24434b5
fix showing pull request link when delete a branch (#5166)
lunny 80da260
UX of link account (Step 1) (#5006)
f69d36b
k8s deployment (#5046)
BetaCat0 2542b66
[skip ci] Updated translations via Crowdin
GiteaBot f7ce2b8
Kill testing processes if the test takes too long (#5174)
typeless 0e29981
fix sqlite and mssql lock (#5214)
lunny 5b49d45
[skip ci] Updated translations via Crowdin
GiteaBot 83fcc6f
Fix emojis not showing in commit messages (#5168)
jamesa af6ac62
fix sqlite lock (#5210)
lunny 966f02f
Serve audio files using HTML5 audio tag (#5221)
cez81 56c8314
[skip ci] Updated translations via Crowdin
GiteaBot c93f12c
Make gitea serv use api/internal (#4886)
sapk 43acff4
[skip ci] Updated translations via Crowdin
GiteaBot 40015e7
remove unused db init on commands serv, update, hooks (#5225)
lunny cc2fd48
fix data race on migrate repository (#5224)
lunny 5a6daf7
Pass link prefixes to external markup parsers (#5201)
Eisfunke 5fadd11
Add AutoHead functionality. (#5186)
zeripath 46da812
[skip ci] Updated translations via Crowdin
GiteaBot 92030cd
only chown directories during docker setup if necessary. Fix #4425 (#…
fabian-braun c012fd5
Generate random password (#5023)
adelowo 51623fc
This commit will reduce join star, repo_topic, topic tables on repo s…
lunny 2ab56e1
Fix markdown image with link (#4675)
LER0ever 6cd41ec
Fix issue where ecdsa and other key types are not synced from LDAP (#…
xor-gate b9bff47
Add changelog for 1.5.3 release (#5227)
lafriks 72e7986
Add command for migrating database (#4954)
rstefan1 60de076
fix compatibility heatmap with mysql 8 (#5232)
5ae50c6
[skip ci] Updated translations via Crowdin
GiteaBot e75fe1b
Update API link in README (#5241)
cez81 3a408b8
fix: Accept web-command cli flags if web-command is commited (#5200)
HoffmannP 215b63b
Keys API changes (#4960)
zeripath 3a6972c
Create AuthorizedKeysCommand (#5236)
zeripath 9cd224c
[skip ci] Updated translations via Crowdin
GiteaBot bacbc57
Update golang version in Dockerfile (#5246)
b3a7c2c
Fixed heatmap not working in mssql (#5248)
kolaente 1be1627
Fixed wrong api request url for instances running in subfolders (#5247)
kolaente 023d812
Update gitignore list (#5258)
sapk b7983c7
Fix #5226 by adding CSRF checking to api reqToken and add CSRF to the…
zeripath 8bb93c6
Add zeripath to maintainers (#5273)
zeripath eafcf90
1.6.0-rc2 changelog (#5276)
techknowlogick edf9411
Clean up docs (#5274)
techknowlogick e0d57fa
Prometheus endpoint (#5256)
6054ac8
Remove maxlines option for file logger (#5282)
lafriks 7359948
[skip ci] Updated translations via Crowdin
GiteaBot 41d70dc
Fix typo in configuration (#5295)
pluehne df9b85b
Fix U2F if gitea is configured in subpath (#5302)
lafriks 4f21e0b
Add option to disable automatic mirror syncing. (#5242)
cez81 3197f73
fix bug when users have serval teams with different units on differen…
lunny 25edcd9
[skip ci] Updated translations via Crowdin
GiteaBot 9c51b78
Fix file edit change preview functionality (#5300)
lafriks 0eac73a
[skip ci] Updated translations via Crowdin
GiteaBot b5c770f
Fix create team, update team missing units (#5188)
lunny 0bd5f6f
Remove x/net/context vendor by using std package (#5202)
sapk dd76689
Block registration based on email domain (#5157)
adelowo dc076df
[skip ci] Updated translations via Crowdin
GiteaBot 7906976
Implement pasting image from clipboard for browsers that supports tha…
lafriks 74f03d3
added the ability to set labels on the "edit pull request" api (#5347)
lucienkerl 89a1eb2
[skip ci] Updated translations via Crowdin
GiteaBot cb37bc1
Set ACL on uploads (#5344)
techknowlogick 5de1348
Migration fixes for gogs (0.11.66) to gitea (1.6.0) #5318 (#5341)
nougad fd9ea48
[skip ci] Updated translations via Crowdin
GiteaBot 154faf7
Add raw blob endpoint to get objects by SHA ID (#5334)
HoffmannP a74bb76
app.ini.sample: add ENABLE_USER_HEATMAP default config (#5362)
sapk 15e42cf
dont' send assign webhooks when creating issue (#5365)
lunny 5563133
add api for user to create org (#5268)
lunny d805745
support envs on external render commands (#5278)
lunny 3af4c56
Show review summary in pull requests (#5132)
kolaente 96e797e
Backport 1.6.0 changelog to master (#5384)
techknowlogick 092efad
[skip ci] Updated translations via Crowdin
GiteaBot 95a419b
[website] file rendering through external binaries (#5387)
juanpablo-santos 99fa5ee
API: '/orgs/:org/repos': return private repos with read access (#5310…
inxonic a04069d
Don't force a password change for the admin user when creating an acc…
adelowo a7b3e41
Fix typos in configuration (#5398)
pluehne 8c7ad40
Fix dependent issue searching when gitea is run in subpath (#5392)
lafriks af99357
Notes on upgrading docker installation (#5395)
ryanhalliday 5355736
changed route from /trees to /git/trees. added additional comments.
Kasi-R 2a959b4
Merge branch 'master' of https://github.com/Kasi-R/gitea
Kasi-R File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright 2018 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package repo | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"code.gitea.io/gitea/modules/setting" | ||
"code.gitea.io/gitea/modules/context" | ||
"code.gitea.io/git" | ||
"code.gitea.io/sdk/gitea" | ||
) | ||
|
||
func GetTree(ctx *context.APIContext) { | ||
sha := ctx.Params("sha") | ||
if len(sha) == 0 { | ||
ctx.Error(400, "sha not provided", nil) | ||
return | ||
} | ||
Tree := GetTreeBySHA(ctx, sha) | ||
if Tree != nil { | ||
ctx.JSON(200, Tree) | ||
} else { | ||
ctx.Error(400, "sha invalid", nil) | ||
} | ||
} | ||
|
||
func GetTreeBySHA(ctx *context.APIContext, sha string) *gitea.GitTreeResponse { | ||
GitTree, err := ctx.Repo.GitRepo.GetTree(sha) | ||
if err != nil || GitTree == nil{ | ||
return nil | ||
} | ||
tree := new(gitea.GitTreeResponse) | ||
RepoID := strings.TrimRight(setting.AppURL, "/") + "/api/v1/repos/" + ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name | ||
tree.SHA = GitTree.ID.String() | ||
tree.URL = RepoID + "/git/trees/" + tree.SHA | ||
var Entries git.Entries | ||
if ctx.QueryBool("recursive") { | ||
Entries, err = GitTree.ListEntriesRecursive() | ||
} else { | ||
Entries, err = GitTree.ListEntries() | ||
} | ||
if err != nil { | ||
return tree | ||
} | ||
RepoIDLen := len(RepoID) | ||
|
||
// 51 is len(sha1) + len("/git/blobs/"). 40 + 11. | ||
BlobURL := make([]byte, RepoIDLen + 51) | ||
copy(BlobURL[:], RepoID) | ||
copy(BlobURL[RepoIDLen:], "/git/blobs/") | ||
|
||
// 51 is len(sha1) + len("/git/trees/"). 40 + 11. | ||
TreeURL := make([]byte, RepoIDLen + 51) | ||
copy(TreeURL[:], RepoID) | ||
copy(TreeURL[RepoIDLen:], "/git/trees/") | ||
|
||
// 40 is the size of the sha1 hash in hexadecimal format. | ||
CopyPos := len(TreeURL) - 40 | ||
|
||
if len(Entries) > 1000 { | ||
tree.Entries = make([]gitea.GitEntry, 1000) | ||
} else { | ||
tree.Entries = make([]gitea.GitEntry, len(Entries)) | ||
} | ||
for e := range Entries { | ||
if e > 1000 { | ||
tree.Truncated = true | ||
break | ||
} | ||
|
||
tree.Entries[e].Path = Entries[e].Name() | ||
tree.Entries[e].Mode = fmt.Sprintf("%06x", Entries[e].Mode()) | ||
tree.Entries[e].Type = string(Entries[e].Type) | ||
tree.Entries[e].Size = Entries[e].Size() | ||
tree.Entries[e].SHA = Entries[e].ID.String() | ||
|
||
if Entries[e].IsDir() { | ||
copy(TreeURL[CopyPos:], Entries[e].ID.String()) | ||
tree.Entries[e].URL = string(TreeURL[:]) | ||
} else { | ||
copy(BlobURL[CopyPos:], Entries[e].ID.String()) | ||
tree.Entries[e].URL = string(BlobURL[:]) | ||
} | ||
} | ||
return tree | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar request here -- where is the
40
coming from?