mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-28 04:51:07 +00:00
[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) (cherry picked from commit78e1755b94) (cherry picked from commit73799479e0) (cherry picked from commit938359b941) (cherry picked from commitb168a9c081) [GITEA] Detect file rename and show in history (squash) ctx.Locale (cherry picked from commit40447752ff) (cherry picked from commitea23594cdb) (cherry picked from commitcdc473850c) (cherry picked from commit86e6641c29) (cherry picked from commit2757de586b) (cherry picked from commitdef4ae32dd)
This commit is contained in:
parent
09b6f58304
commit
6dada09329
22 changed files with 140 additions and 2 deletions
|
|
@ -278,3 +278,30 @@ func TestGetCommitFileStatusMerges(t *testing.T) {
|
|||
assert.Equal(t, commitFileStatus.Removed, expected.Removed)
|
||||
assert.Equal(t, commitFileStatus.Modified, expected.Modified)
|
||||
}
|
||||
|
||||
func TestParseCommitRenames(t *testing.T) {
|
||||
testcases := []struct {
|
||||
output string
|
||||
renames [][2]string
|
||||
}{
|
||||
{
|
||||
output: "R090\x00renamed.txt\x00history.txt\x00",
|
||||
renames: [][2]string{{"renamed.txt", "history.txt"}},
|
||||
},
|
||||
{
|
||||
output: "R090\x00renamed.txt\x00history.txt\x00R000\x00corruptedstdouthere",
|
||||
renames: [][2]string{{"renamed.txt", "history.txt"}},
|
||||
},
|
||||
{
|
||||
output: "R100\x00renamed.txt\x00history.txt\x00R001\x00readme.md\x00README.md\x00",
|
||||
renames: [][2]string{{"renamed.txt", "history.txt"}, {"readme.md", "README.md"}},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testcase := range testcases {
|
||||
renames := [][2]string{}
|
||||
parseCommitRenames(&renames, strings.NewReader(testcase.output))
|
||||
|
||||
assert.Equal(t, testcase.renames, renames)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue