Commits API Pagination Broken
Summary
When using the API to access the commits the pagination requires using a 0 index when other pagination settings use 1 as the first page.
Steps to reproduce
Create a repository with less than 20 commits
curl -H "PRIVATE-TOKEN: TOKEN" http://gitlab-dev/api/v3/projects/13/repository/commits?page=1
[]
When using page=0 the commits so up.
curl -H "PRIVATE-TOKEN: TOKEN" http://gitlab-dev/api/v3/projects/13/repository/commits?page=0
[
{
"id": "b68108b0e68f8394987df60ea0b7d09bbebb2f51",
"short_id": "b68108b0",
"title": "Commit #2",
"author_name": "User",
"author_email": "me@home",
"created_at": "2016-07-25T09:19:16.000+10:00",
"message": "Commit #2"
},
{
"id": "8084446ce66e77dd10e98924b7607de099bde7f9",
"short_id": "8084446c",
"title": "Added README.md",
"author_name": "User",
"author_email": "me@home",
"created_at": "2016-07-25T09:18:52.000+10:00",
"message": "Added README.md"
}
]
Expected behavior
curl -H "PRIVATE-TOKEN: TOKEN" http://gitlab-dev/api/v3/projects/13/repository/commits?page=1
[
{
"id": "b68108b0e68f8394987df60ea0b7d09bbebb2f51",
"short_id": "b68108b0",
"title": "Commit #2",
"author_name": "User",
"author_email": "me@home",
"created_at": "2016-07-25T09:19:16.000+10:00",
"message": "Commit #2"
},
{
"id": "8084446ce66e77dd10e98924b7607de099bde7f9",
"short_id": "8084446c",
"title": "Added README.md",
"author_name": "User",
"author_email": "me@home",
"created_at": "2016-07-25T09:18:52.000+10:00",
"message": "Added README.md"
}
]
Output of checks
Results of GitLab Application Check
Checking GitLab Shell ...
GitLab Shell version >= 3.2.0 ? ... OK (3.2.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
2/8 ... ok
2/9 ... ok
2/10 ... ok
2/13 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
2/8 ... yes
2/9 ... yes
2/10 ... yes
2/13 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.1.8)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 4
Checking GitLab ... Finished
Results of GitLab Environment Info
System information
System: Debian 8.5
Current User: git
Using RVM: no
Ruby Version: 2.1.8p440
Gem Version: 2.5.1
Bundler Version:1.10.6
Rake Version: 10.5.0
Sidekiq Version:4.1.4
GitLab information
Version: 8.10.0
Revision: 9dec995
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: http://gitlab-dev.cecs.anu.edu.au
HTTP Clone URL: http://gitlab-dev.cecs.anu.edu.au/some-group/some-project.git
SSH Clone URL: git@gitlab-dev.cecs.anu.edu.au:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 3.2.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git