diff options
author | Odin Ugedal <odin@ugedal.com> | 2016-11-06 22:15:44 +0100 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2016-11-06 19:15:44 -0200 |
commit | 5a6f7edde97c5ff9811bbc79f5f5fc4c16703683 (patch) | |
tree | 600b522688a0035473f052fb2bda5310143fb945 | |
parent | 92c48dabe39dee85dbec02adfe1b6b429c004102 (diff) | |
download | gitea-5a6f7edde97c5ff9811bbc79f5f5fc4c16703683.tar.gz gitea-5a6f7edde97c5ff9811bbc79f5f5fc4c16703683.zip |
Use the rev-parsed sha1 commit id (#98)
Use the rev-parsed sha1 commit id in urls to repo files,
instead of the abbreviated version.
-rw-r--r-- | routers/repo/commit.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 6d7eec92ad..1fd4eb8d0b 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -9,11 +9,11 @@ import ( "path" "github.com/Unknwon/paginater" + "github.com/go-gitea/git" "github.com/go-gitea/gitea/models" "github.com/go-gitea/gitea/modules/base" "github.com/go-gitea/gitea/modules/context" "github.com/go-gitea/gitea/modules/setting" - "github.com/go-gitea/git" ) const ( @@ -158,7 +158,9 @@ func Diff(ctx *context.Context) { } return } - + if len(commitID) != 40 { + commitID = commit.ID.String() + } diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName), commitID, setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles) |