* 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>
* Adds functions to handle checking out branches and moving files
Adds support for checking out a new branch
Fix for branch pull requests
* Adds methods to get files changes between two commits
This fixes regression introduced in ebd9fb2253,
that GetSubModules was always returning empty submodule info because
c.submoduleCache != nil check was always true since parseCommitData was setting
commit.submoduleCache = newObjectCache() so it was always not-nil.
Now we initialize submoduleCache in first GetSubModules call, next call will
return cached entries.