diff --git a/routers/repo/commit.go b/routers/repo/commit.go index bf03d53ee..21e5e9162 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -179,14 +179,14 @@ func Diff(ctx *context.Context) { ctx.HTML(200, DIFF) } -func RawDiff(ctx *context.Context) { +func RawDiff(c *context.Context) { if err := git.GetRawDiff( - models.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name), - ctx.Params(":sha"), - git.RawDiffType(ctx.Params(":ext")), - ctx.Resp, + models.RepoPath(c.Repo.Owner.Name, c.Repo.Repository.Name), + c.Params(":sha"), + git.RawDiffType(c.Params(":ext")), + c.Resp, ); err != nil { - ctx.Handle(500, "GetRawDiff", err) + c.NotFoundOrServerError("GetRawDiff", git.IsErrNotExist, err) return } } diff --git a/vendor/github.com/gogits/git-module/repo_commit.go b/vendor/github.com/gogits/git-module/repo_commit.go index 78ff04094..34349c683 100644 --- a/vendor/github.com/gogits/git-module/repo_commit.go +++ b/vendor/github.com/gogits/git-module/repo_commit.go @@ -106,7 +106,7 @@ func (repo *Repository) getCommit(id sha1) (*Commit, error) { data, err := NewCommand("cat-file", "-p", id.String()).RunInDirBytes(repo.Path) if err != nil { - if strings.Contains(err.Error(), "fatal: Not a valid object name") { + if strings.Contains(err.Error(), "exit status 128") { return nil, ErrNotExist{id.String(), ""} } return nil, err @@ -129,6 +129,9 @@ func (repo *Repository) GetCommit(commitID string) (*Commit, error) { var err error commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path) if err != nil { + if strings.Contains(err.Error(), "exit status 128") { + return nil, ErrNotExist{commitID, ""} + } return nil, err } } diff --git a/vendor/vendor.json b/vendor/vendor.json index 762d1f701..7bb4496f6 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -159,10 +159,10 @@ "revisionTime": "2016-08-10T03:50:02Z" }, { - "checksumSHA1": "iZ3qMzzA24U3eqGifUZa6kFuCqk=", + "checksumSHA1": "XT0fyELKMKgb4XeMAtIrmi4SetM=", "path": "github.com/gogits/git-module", - "revision": "5dba4f883034198eabac620b73aabf5488fcd821", - "revisionTime": "2017-04-04T05:34:13Z" + "revision": "2a496cad1f36aed60b14844b33b68eb3edfc2718", + "revisionTime": "2017-04-04T05:59:12Z" }, { "checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",