mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Calculate filename hash only once (#19654)
* Calculate hash only once. * remove unused Sha1 template helper function, use ctx.Data["FileNameHash"] * fix unit tests
This commit is contained in:
@@ -37,6 +37,7 @@ func TestGetDiffPreview(t *testing.T) {
|
||||
{
|
||||
Name: "README.md",
|
||||
OldName: "README.md",
|
||||
NameHash: "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d",
|
||||
Index: 1,
|
||||
Addition: 2,
|
||||
Deletion: 1,
|
||||
@@ -123,7 +124,7 @@ func TestGetDiffPreview(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
bs, err := json.Marshal(diff)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, expectedBs, bs)
|
||||
assert.EqualValues(t, string(expectedBs), string(bs))
|
||||
})
|
||||
|
||||
t.Run("empty branch, same results", func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user