-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# These are the LFS objects in user2/lfs.git | ||
- | ||
|
||
id: 1 | ||
oid: 0b8d8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351 | ||
size: 107 | ||
repository_id: 54 | ||
created_unix: 1671607299 | ||
|
||
- | ||
|
||
id: 2 | ||
oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c | ||
size: 107 | ||
repository_id: 54 | ||
created_unix: 1671607299 | ||
|
||
- | ||
|
||
id: 3 | ||
oid: 7b6b2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623 | ||
size: 27 | ||
repository_id: 54 | ||
created_unix: 1671607299 | ||
|
||
- | ||
|
||
id: 4 | ||
oid: 9d172e5c64b4f0024b9901ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82 | ||
size: 25 | ||
repository_id: 54 | ||
created_unix: 1671607299 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -550,3 +550,9 @@ | |
repo_id: 53 | ||
type: 1 | ||
created_unix: 946684810 | ||
|
||
- | ||
id: 81 | ||
repo_id: 54 | ||
type: 1 | ||
created_unix: 946684810 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+107 Bytes
tests/gitea-lfs-meta/0b/8d/8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351
Binary file not shown.
Binary file added
BIN
+2 KB
tests/gitea-lfs-meta/2e/cc/db43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c
Binary file not shown.
1 change: 1 addition & 0 deletions
1
tests/gitea-lfs-meta/7b/6b/2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Testing documents in LFS |
1 change: 1 addition & 0 deletions
1
tests/gitea-lfs-meta/9d/17/2e5c64b4f0024b9901ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Testing READMEs in LFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true |
Binary file added
BIN
+228 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/15/2de0f78bc6815b58cd9f08aebe3f66fb0f172e
Binary file not shown.
Binary file added
BIN
+123 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/23/10e4a07f9314a1a92fdfbdcd3d2884f01e96ab
Binary file not shown.
Binary file added
BIN
+122 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/2b/6c6c4eaefa24b22f2092c3d54b263ff26feb58
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...s/gitea-repositories-meta/user2/lfs.git/objects/73/cf03db6ece34e12bf91e8853dc58f678f2f82d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
x��Q | ||
B!E�v��bƗ�AD����7���0���V���¹'�Rr���M��Y0Y";2��8:/A�Ĝ&�Z�_��6�����]��g���\dk9�%�i��h�XG��?O]�g���@}97� |
Binary file added
BIN
+123 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/74/21a018a7e3f15ee5691f162d0ed87dc19882f0
Binary file not shown.
Binary file added
BIN
+38 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/82/76d2a29779af982c0afa976bdb793b52d442a8
Binary file not shown.
Binary file added
BIN
+92 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/bc/e50ea8f203ee923d5a640d05208abf3206486e
Binary file not shown.
Binary file added
BIN
+123 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/d4/a41a0d4db4949e129bd22f871171ea988103ef
Binary file not shown.
Binary file added
BIN
+55 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/d7/ce0013ced38b0696dd2d68d69a5d8b652f7148
Binary file not shown.
Binary file added
BIN
+75 Bytes
...s/gitea-repositories-meta/user2/lfs.git/objects/df/d8105b264d304c49ed9f1d56bd90189ecdf833
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
73cf03db6ece34e12bf91e8853dc58f678f2f82d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright 2022 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package integration | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"code.gitea.io/gitea/tests" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// check that files stored in LFS render properly in the web UI | ||
func TestLFSRender(t *testing.T) { | ||
defer tests.PrepareTestEnv(t)() | ||
|
||
session := loginUser(t, "user2") | ||
|
||
// check that a markup file is flagged with "Stored in Git LFS" and shows its text | ||
t.Run("Markup", func(t *testing.T) { | ||
defer tests.PrintCurrentTest(t)() | ||
|
||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md") | ||
resp := session.MakeRequest(t, req, http.StatusOK) | ||
|
||
doc := NewHTMLParser(t, resp.Body).doc | ||
|
||
fileInfo := doc.Find("div.file-info-entry").First().Text() | ||
assert.Contains(t, fileInfo, "Stored with Git LFS") | ||
|
||
content := doc.Find("div.file-view").Text() | ||
assert.Contains(t, content, "Testing documents in LFS") | ||
}) | ||
|
||
// check that an image is flagged with "Stored in Git LFS" and renders inline | ||
t.Run("Image", func(t *testing.T) { | ||
defer tests.PrintCurrentTest(t)() | ||
|
||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/jpeg.jpg") | ||
resp := session.MakeRequest(t, req, http.StatusOK) | ||
|
||
doc := NewHTMLParser(t, resp.Body).doc | ||
|
||
fileInfo := doc.Find("div.file-info-entry").First().Text() | ||
assert.Contains(t, fileInfo, "Stored with Git LFS") | ||
|
||
src, exists := doc.Find(".file-view img").Attr("src") | ||
assert.True(t, exists, "The image should be in an <img> tag") | ||
assert.Equal(t, "/user2/lfs/media/branch/master/jpeg.jpg", src, "The image should use the /media link because it's in LFS") | ||
}) | ||
|
||
// check that a binary file is flagged with "Stored in Git LFS" and renders a /media/ link instead of a /raw/ link | ||
t.Run("Binary", func(t *testing.T) { | ||
defer tests.PrintCurrentTest(t)() | ||
|
||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/crypt.bin") | ||
resp := session.MakeRequest(t, req, http.StatusOK) | ||
|
||
doc := NewHTMLParser(t, resp.Body).doc | ||
|
||
fileInfo := doc.Find("div.file-info-entry").First().Text() | ||
assert.Contains(t, fileInfo, "Stored with Git LFS") | ||
|
||
rawLink, exists := doc.Find("div.file-view > div.view-raw > a").Attr("href") | ||
assert.True(t, exists, "Download link should render instead of content because this is a binary file") | ||
assert.Equal(t, "/user2/lfs/media/branch/master/crypt.bin", rawLink, "The download link should use the proper /media link because it's in LFS") | ||
}) | ||
|
||
// check that a directory with a README file shows its text | ||
t.Run("Readme", func(t *testing.T) { | ||
defer tests.PrintCurrentTest(t)() | ||
|
||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/subdir") | ||
resp := session.MakeRequest(t, req, http.StatusOK) | ||
|
||
doc := NewHTMLParser(t, resp.Body).doc | ||
|
||
content := doc.Find("div.file-view").Text() | ||
assert.Contains(t, content, "Testing READMEs in LFS") | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters