* GetCommit() returns a ErrNotExist if short commit ID does not exists
Currently, GetCommit() returns a generic error if a short commit ID
does not exists in a repository.
When a commit is not found by git-rev-parse, it returns an errors
which contains "fatal: ambiguous argument". GetCommit() now search if
the error contains this string, and, if it does, returns an
ErrNotExist.
The idea is to allow commits to be accessed from gitea with a short
commit ID. Without this change, it would return a 500 Internal Server
Error when a short ID does not exists in the repository.
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
* GetCommit(): change the comparison for short commit messages
`fatal: ambiguous argument` can be the beginning of two errors in
git. This changes the comparison to something less ambiguous.
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
* Refactor branch list using src-d/go-git and add GetRefs function
* Fix copyright
* Fix to reuse ObjectType
* Add function to filter refs by prefix
* Fix import order
* Optimize if structure
* Add repo_blob
This adds a new Repository.GetBlob(id) method for use by gitea.
* This is a follow-up for PR #121 to implement blob_api including full test coverage
Signed-off-by: Berengar W. Lehr <Berengar.Lehr@kompetenztest.de>
* Add line blame
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Use uint instead of int to prevent failures
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add an head ref for the sake of using self repo for testing
* Add test for CommitCount
* Add testing with git-1.7.2
* Add test for GetLatestCommitTime
The test checks that latest commit time is before now
and more recent than the commit this PR is based at
Test no error is raised by time parsing and GetLatestCommitTime
Print actual time when tests fail
* Accept git 1.7.2 as the minimum version
Debian old old (very old) distribution (6.0 aka Squeeze)
ships version 1.7.10.4.
The version requirement was raised in #46 supposedly for the
need of "symbolic-ref" command, but that command is supported
by the 1.7.2 version too, and possibly even older versions.
* Reduce output from drone, add comments
Reduce steps, concatenating them in logical steps
* Interrupt step upon first failure
* Add Dockerfile for use with ci
* Use ad-hoc docker image for testing git-1.7.2
* Avoid running build/vet/clean twice
* Set HEAD ref also in testing-1-7 step