forked from kevadesu/forgejo
[GITEA] Detect file rename and show in history
- Add a indication to the file history if the file has been renamed, this indication contains a link to browse the history of the file further. - Added unit testing. - Added integration testing. - Resolves https://codeberg.org/forgejo/forgejo/issues/1279 (cherry picked from commit72c297521b
) (cherry picked from commit283f964894
) Conflicts: options/locale/locale_en-US.ini https://codeberg.org/forgejo/forgejo/pulls/1550 (cherry picked from commit7c30af7fde
) (cherry picked from commitf3be6eb269
)
This commit is contained in:
parent
5b7a43c43f
commit
78e1755b94
22 changed files with 140 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
P pack-6dd3a6fe138f1d77e14c2e6b8e6c41e5ae242adf.pack
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
# pack-refs with: peeled fully-peeled sorted
|
||||
d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/heads/master
|
||||
d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/heads/cake-recipe
|
||||
80b83c5c8220c3aa3906e081f202a2a7563ec879 refs/heads/master
|
||||
d8f53dfb33f6ccf4169c34970b5e747511c18beb refs/tags/v1.0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
d8f53dfb33f6ccf4169c34970b5e747511c18beb
|
|
@ -690,3 +690,33 @@ func TestDangerZoneConfirmation(t *testing.T) {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestRenamedFileHistory(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
t.Run("Renamed file", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/license")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
renameNotice := htmlDoc.doc.Find(".ui.bottom.attached.header")
|
||||
assert.Equal(t, 1, renameNotice.Length())
|
||||
assert.Contains(t, renameNotice.Text(), "Renamed from licnse (Browse further)")
|
||||
|
||||
oldFileHistoryLink, ok := renameNotice.Find("a").Attr("href")
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "/user2/repo59/commits/commit/80b83c5c8220c3aa3906e081f202a2a7563ec879/licnse", oldFileHistoryLink)
|
||||
})
|
||||
|
||||
t.Run("Non renamed file", func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/README.md")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
htmlDoc.AssertElement(t, ".ui.bottom.attached.header", false)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue