Skip to content
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

Git-Trees API. #4185

Closed
wants to merge 450 commits into from
Closed

Git-Trees API. #4185

wants to merge 450 commits into from

Conversation

Kasi-R
Copy link
Contributor

@Kasi-R Kasi-R commented Jun 8, 2018

Started on Git-Trees API. Added methods for getting a tree and getting a tree recursively as per https://developer.github.com/v3/git/trees/

Creating a tree not done.

@techknowlogick techknowlogick added the modifies/api This PR adds API routes or modifies them label Jun 8, 2018
routers/api/v1/repo/tree.go Outdated Show resolved Hide resolved
routers/api/v1/repo/tree.go Outdated Show resolved Hide resolved
routers/api/v1/api.go Outdated Show resolved Hide resolved
@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 13, 2018
@Kasi-R
Copy link
Contributor Author

Kasi-R commented Jun 13, 2018

Done. I used the types from go-gitea/go-sdk#109 however, i can change it to the types used in go-gitea/go-sdk#94 if required.

@techknowlogick
Copy link
Member

@Kasi-R would it be possible to use other PR in SDK? I think it would be best to merge in functionality then another PR for enhancement.

@techknowlogick
Copy link
Member

techknowlogick commented Nov 24, 2018

@lafriks please update review. Can you also review go-gitea/go-sdk#94?

m.Group("/:username/:reponame", func() {
m.Combo("").Get(repo.Get).Delete(reqToken(), repo.Delete)
m.Group("/trees", func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably use github compatible route (/git/trees)

@lafriks
Copy link
Member

lafriks commented Nov 24, 2018

@techknowlogick done

Copy link

@necaris necaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of small requests for better explanation of where some constants are coming from -- otherwise this looks good, very straightforward -- certainly simpler than my attempt #1978 !

return tree
}
RepoIDLen := len(RepoID)
BlobURL := make([]byte, RepoIDLen + 47)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kasi-R could you please add a comment or variable describing where the magic number 47 comes from?

BlobURL := make([]byte, RepoIDLen + 47)
copy(BlobURL[:], RepoID)
copy(BlobURL[RepoIDLen:], "/blobs/")
TreeURL := make([]byte, RepoIDLen + 47)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above -- same here please.

TreeURL := make([]byte, RepoIDLen + 47)
copy(TreeURL[:], RepoID)
copy(TreeURL[RepoIDLen:], "/trees/")
CopyPos := len(TreeURL) - 40
Copy link

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?

SagePtr and others added 17 commits November 26, 2018 06:42
* Make sure author cannot reject/approve their own PR

* Disable buttons in templates too

* Remove unneccessary if check since the switch below catches it

* Fix IsOwner check

* Update template and remove new template variable

* Add alert template and redirect to diff page on review failure

* Redirect to files diff as a little update to #4632
* Make sure to reset commit count in the cache on mirror syncing

* reset count of commits in all branches
GiteaBot and others added 27 commits November 26, 2018 06:42
* Update dep github.com/markbates/goth

* Update dep github.com/blevesearch/bleve

* Update dep golang.org/x/oauth2

* Fix github.com/blevesearch/bleve to c74e08f039e56cef576e4336382b2a2d12d9e026

* Update dep golang.org/x/oauth2
* implement email domain whitelist
* Remove field from migration to support upgrades from older version

That will ensure the field does not get queried in the Select if it does
not exist yet:

```
[I] [SQL] SELECT "id", "repo_id", "index", "poster_id", "name", "content", "milestone_id", "priority", "assignee_id", "is_closed", "is_pull", "num_comments", "ref", "deadline_unix", "created_unix", "updated_unix
[...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: pq: column "ref" does not exist
```

see #5318

* Skip remove stale watcher migration if not required

Otherwise the migration will fail if executed from a older database
version without multiple IssueWatch feature.

```
2018/11/11 23:51:14 [I] [SQL] SELECT DISTINCT "issue_watch"."user_id", "issue"."repo_id" FROM "issue_watch" INNER JOIN issue ON issue_watch.issue_id = issue.id WHERE (issue_watch.is_watching = $1) LIMIT 50 []int
[...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: pq: relation "issue_watch" does not exist
```

see #5318
* Add raw blob endpoint

This should make it possible to download raw blobs directly from
/:repo/:username/raw/blob/:sha1 URLs.

* fix: Make it work

* As an SHA-ID is no path getRefNameFromPath can't be used to verify
file specifying parameter
* added relevant change in go-gitea/git #132

Signed-off-by: Berengar W. Lehr <[email protected]>

* Update Gopkg.lock

Can't update all vendors due to errors

Signed-off-by: Berengar W. Lehr <[email protected]>

* style: Add Gitea copyright header

* feat: Added integration test for /repo/u/r/raw/blob

* fix: correct year in copyright header
* add api for user to create org

* remove unused blank line on the swagger file end

* fix create and add test

* fix tests

* fix routes of create org API

* fix bug

* add copyright heads
* #3758: [doc] file rendering through external binaries

* fix subsections markup

* include proposed changes from PR review
…ount via cli (#5391)

* don't force a password change for the admin user

* don't totally dicard -must-change-password flag if creating the first (admin) user via the cli. Use flag if present but make sure to default to not forcing a password update
* Notes on upgrading docker installation

Basis from [gogs/gogs](https://github.com/gogs/gogs/blob/master/docker/README.md)

* Feedback from @sapk to use docker-compose only
@Kasi-R Kasi-R closed this Nov 26, 2018
@Kasi-R Kasi-R mentioned this pull request Nov 26, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet