Remove the view command and the editor setting with it

`view` was the last user of `editor`, so leaving the setting behind would
have made it exactly what `gitkey` was until recently: documented,
parsed, and doing nothing. It is gone from the struct, the template, the
environment, `config -k` and the settings table.

Both names are free for aliases now, as `open` already was.

The tests that used `editor` as their example of a project-overridable
setting use `gitkey` instead, which is the same kind of thing and still
exists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 19:11:06 +02:00
co-authored by Claude Opus 5
parent 65342bcd7c
commit cd5ab1a2bd
10 changed files with 17 additions and 64 deletions
+8 -8
View File
@@ -142,7 +142,7 @@ func TestParseConfig(t *testing.T) {
githost = 10.0.0.1
GitPort: 22
gituser = "deploy"
editor = 'code'
gitkey = 'mgit_rsa'
ignored line without separator
base=/tmp/src
`
@@ -151,7 +151,7 @@ base=/tmp/src
"githost": "10.0.0.1",
"gitport": "22",
"gituser": "deploy",
"editor": "code",
"gitkey": "mgit_rsa",
"base": "/tmp/src",
}
for k, want := range checks {
@@ -166,7 +166,7 @@ base=/tmp/src
func TestParseConfigInlineComments(t *testing.T) {
rc := `
editor = code # fallback opener for ` + "`open`" + `
gitkey = mgit_rsa # fallback opener comment
mirror = true # ` + "`push`" + ` also mirrors via pushremote
gitport = 22 # ssh port
remotekey = abc#123
@@ -176,7 +176,7 @@ gitemail = # value is only a comment
`
m := parseConfig(rc)
checks := map[string]string{
"editor": "code",
"gitkey": "mgit_rsa",
"mirror": "true",
"gitport": "22",
"remotekey": "abc#123", // '#' not preceded by space stays part of the value
@@ -539,7 +539,7 @@ func TestResolveProjectConfig(t *testing.T) {
dir := t.TempDir()
global := Config{
Base: "/base", GitHost: "global.example", GitPort: "22", GitUser: "git",
GitPath: "/home/git", GitName: "Global Name", Editor: "vi",
GitPath: "/home/git", GitName: "Global Name", GitKey: "global_rsa",
Remotes: []RemoteTarget{{Name: "gitea", URL: "https://gitea.example", Key: "tok"}},
}
@@ -550,7 +550,7 @@ func TestResolveProjectConfig(t *testing.T) {
rc := `
githost = project.example
editor = code
gitkey = project_rsa
base = /somewhere/else
gitname = Project Name
remote.hub.url = https://github.com
@@ -562,8 +562,8 @@ remote.gitea.visibility = public
}
got := resolveConfig(global, dir)
if got.GitHost != "project.example" || got.Editor != "code" {
t.Errorf("project overrides not applied: host=%q editor=%q", got.GitHost, got.Editor)
if got.GitHost != "project.example" || got.GitKey != "project_rsa" {
t.Errorf("project overrides not applied: host=%q gitkey=%q", got.GitHost, got.GitKey)
}
// base and the git identity stay global
if got.Base != "/base" {