Skip to content

Commit 5a6f7ed

Browse files
odinugeandreynering
authored andcommitted
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.
1 parent 92c48da commit 5a6f7ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

routers/repo/commit.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"path"
1010

1111
"github.com/Unknwon/paginater"
12+
"github.com/go-gitea/git"
1213
"github.com/go-gitea/gitea/models"
1314
"github.com/go-gitea/gitea/modules/base"
1415
"github.com/go-gitea/gitea/modules/context"
1516
"github.com/go-gitea/gitea/modules/setting"
16-
"github.com/go-gitea/git"
1717
)
1818

1919
const (
@@ -158,7 +158,9 @@ func Diff(ctx *context.Context) {
158158
}
159159
return
160160
}
161-
161+
if len(commitID) != 40 {
162+
commitID = commit.ID.String()
163+
}
162164
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
163165
commitID, setting.Git.MaxGitDiffLines,
164166
setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles)

0 commit comments

Comments
 (0)