mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
refactor: remove features beyond the UX plan
Drop additions that the UX plan does not ask for: - the interactive label edit form; label edit now requires a flag - label clone and the skip mode of label creation it needed - repo rename rewriting the Git remote or tea.repository; it now warns that the remote still points to the old name - the extra "source" remote on clones of pull mirrors - run artifact download, which duplicates run download --zip - 256-color and 24-bit label swatches; colors stay ANSI 16 - config list --show-source (config get keeps it) - the membership and access GETs before team member/repo add and remove; Gitea's PUT and DELETE are idempotent label edit/delete keep --by-name: it is the only way to address a label whose name is a number that is also another label's ID. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
22 files changed
+69
-560
No files matched your search
@@ -124,7 +124,7 @@ func TestRepoArchiveAsksWithTheConsequence(t *testing.T) {
|
||||
require.Equal(t, []string{"Archive alice/project (from git remote upstream)? It becomes read-only."}, prompt.confirmations)
|
||||
}
|
||||
|
||||
func TestRepoRenameFollowsTheRemote(t *testing.T) {
|
||||
func TestRepoRenameHintsAtTheRemote(t *testing.T) {
|
||||
server := newAuthenticatedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
require.Equal(t, http.MethodPatch+" /api/v1/repos/alice/project", r.Method+" "+r.URL.Path)
|
||||
requirePayload(t, `{"name":"renamed"}`, r.Body)
|
||||
@@ -132,31 +132,14 @@ func TestRepoRenameFollowsTheRemote(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
deps, out, diagnostics := repoTTYDeps(t, server.URL)
|
||||
runner := &fakeGit{results: map[string]string{
|
||||
"symbolic-ref --short HEAD": "main",
|
||||
"config --get branch.main.remote": "origin",
|
||||
"remote get-url origin": server.URL + "/alice/project.git",
|
||||
"remote set-url origin " + server.URL + "/alice/renamed.git": "",
|
||||
deps.Git = &fakeGit{results: map[string]string{
|
||||
"symbolic-ref --short HEAD": "main",
|
||||
"config --get branch.main.remote": "origin",
|
||||
"remote get-url origin": server.URL + "/alice/project.git",
|
||||
}}
|
||||
deps.Git = runner
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"repo", "rename", "renamed", "--yes"}))
|
||||
require.Contains(t, runner.calls, "remote set-url origin "+server.URL+"/alice/renamed.git")
|
||||
require.Empty(t, out.String())
|
||||
require.Equal(t, "✓ Renamed repository alice/project to alice/renamed\n✓ Updated Git remote origin to alice/renamed\n", diagnostics.String())
|
||||
}
|
||||
|
||||
func TestRenamedURL(t *testing.T) {
|
||||
for _, test := range []struct{ raw, want string }{
|
||||
{"https://gitea.test/alice/project.git", "https://gitea.test/alice/renamed.git"},
|
||||
{"https://gitea.test/alice/project/", "https://gitea.test/alice/renamed"},
|
||||
{"git@gitea-alias:alice/Project.git", "git@gitea-alias:alice/renamed.git"},
|
||||
{"ssh://git@gitea.test:2222/alice/project", "ssh://git@gitea.test:2222/alice/renamed"},
|
||||
{"https://gitea.test/alice/subproject.git", ""},
|
||||
} {
|
||||
renamed, ok := renamedURL(test.raw, "project", "renamed")
|
||||
require.Equal(t, test.want != "", ok, test.raw)
|
||||
require.Equal(t, test.want, renamed, test.raw)
|
||||
}
|
||||
require.Equal(t, "✓ Renamed repository alice/project to alice/renamed\n! Git remote origin still points to alice/project; update it with git remote set-url\n", diagnostics.String())
|
||||
}
|
||||
|
||||
func TestRepoForkReportsAnExistingFork(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user