Commit Graph

3 Commits (927ffef8646b5743fb595d04290be3780c0cf5e8)

Author SHA1 Message Date
ᴜɴᴋɴᴡᴏɴ 927ffef864
api: minor changes to `/repo/owner/repo/git/trees` (#5982) 2020-03-11 01:28:26 +08:00
ᴜɴᴋɴᴡᴏɴ 6437d0180b
git: migrate to github.com/gogs/git-module@v1.0.0 (#5958)
* WIP

* Finish `internal/db/git_diff.go`

* FInish internal/db/mirror.go

* Finish internal/db/pull.go

* Finish internal/db/release.go

* Finish internal/db/repo.go

* Finish internal/db/repo_branch.go

* Finish internal/db/repo_editor.go

* Finish internal/db/update.go

* Save my work

* Add license header

* Compile!

* Merge master

* Finish internal/cmd/hook.go

* Finish internal/conf/static.go

* Finish internal/context/repo.go

* Finish internal/db/action.go

* Finish internal/db/git_diff.go

* Fix submodule URL inferring

* Finish internal/db/mirror.go

* Updat to beta.4

* css: update fonts

* Finish internal/db/pull.go

* Finish internal/db/release.go

* Finish internal/db/repo_branch.go

* Finish internal/db/wiki.go

* gitutil: enhance infer submodule UR

* Finish internal/route/api/v1/repo/commits.go

* mirror: only collect branch commits after sync

* mirror: fix tag support

* Finish internal/db/repo.go

* Finish internal/db/repo_editor.go

* Finish internal/db/update.go

* Finish internal/gitutil/pull_request.go

* Make it compile

* Finish internal/route/repo/setting.go

* Finish internal/route/repo/branch.go

* Finish internal/route/api/v1/repo/file.go

* Finish internal/route/repo/download.go

* Finish internal/route/repo/editor.go

* Use helper

* Finish internal/route/repo/issue.go

* Finish internal/route/repo/pull.go

* Finish internal/route/repo/release.go

* Finish internal/route/repo/repo.go

* Finish internal/route/repo/wiki.go

* Finish internal/route/repo/commit.go

* Finish internal/route/repo/view.go

* Finish internal/gitutil/tag.go

* go.sum
2020-03-08 19:09:31 +08:00
Bharat Nallan cf3d55fa10
api: support getting repository Git tree (#5934) (#5937)
* add basic git repository tree api (#5934)

This PR adds the tree  api endpoint to gogs api:
`GET/repos/:owner/:repo/git/trees/:tree_sha`

This new api endpoint that is being added is in conformance to
the GitHub REST API v3 specification. Documentation can be found
here: developer.github.com/v3/git/trees/#get-a-tree

For a given user, repo and sha value, this api (currently) returns
a single tree using the SHA1 value for that tree.

- Recursive implementation is yet to be implemented.
- Creating a Tree using POST is yet to be implemented.

Example curl:

```

l curl -H "Authorization: token REDACTED" c59441ded1 -X GET  | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   940  100   940    0     0  12034      0 --:--:-- --:--:-- --:--:-- 12051

[
  {
    "sha": "c59441ded1549b149def0d4c54594d31a7f3718f",
    "tree": [
      {
        "mode": "120000",
        "path": "/home/bharatnc/gogs-repositories/root/testrepo.git",
        "sha": "472ac2361b65136b393d652de25341e2ea44f299",
        "size": 1077,
        "type": "blob",
        "url": "472ac2361b"
      },
      {
        "mode": "120000",
        "path": "/home/bharatnc/gogs-repositories/root/testrepo.git",
        "sha": "70fcb456d436f08462602f26df6fb7e167e7a916",
        "size": 12,
        "type": "blob",
        "url": "70fcb456d4"
      },
      {
        "mode": "120000",
        "path": "/home/bharatnc/gogs-repositories/root/testrepo.git",
        "sha": "092c58d4b63df5779a4d020b1fdbb762421bbb4f",
        "size": 380,
        "type": "blob",
        "url": "092c58d4b6"
      }
    ],
    "url": "c59441ded1"
  }
]

```

* remove vertical space

* make go.mod to be same as in master

* rename structs to sound better

* simplify expressions and fix error msg

* Update tree.go

* Update tree.go

* display file name instead of repo path

* Update tree.go

Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
2020-02-25 22:19:42 +08:00